<?php

function getTblHd($srcNowShowAcl, $trCls, $papers, $ch, $protmod, $rate0open, $qchkbx)
{
    $reStr = "<table width=\"100%\" border=\"1\" cellpadding=\"3\" cellspacing=\"0\" class=\"paperTable\"><thead>";
    $reStr .= "<tr class=" . $trCls . "><td colspan=20 align=center>" . $ch;
    if ($papers == "1")
    {
        switch ($srcNowShowAcl)
        {
            case 5 :
                $reStr .= "<tr class=" . $trCls . " align=center nowrap><td nowrap width='10%'>大股东帐号名称<td nowrap>笔数<td nowrap>下注金额";
                $reStr .= "<td nowrap>会员结果<td nowrap>大股东结果<td nowrap>公司结果<td nowrap>收飞<td nowrap>收飞结果<td nowrap>总监退水<td nowrap>公司合计";
                if ($qchkbx)
                {
                    $reStr .= "<td nowrap>贡献额<td nowrap>贡献度";
                }
                $reStr .= "</thead>";
                break;
            case 4 :
                $reStr .= "<tr class=" . $trCls . " align=center>";
                $reStr .= "<td nowrap rowspan=2 width='10%'>股东帐号名称<td nowrap rowspan=2>笔数<td nowrap rowspan=2>下注金额";
                if (0 < $protmod)
                {
                    $reStr .= "<td nowrap rowspan=2>会员结果<td nowrap rowspan=2>股东交收<td nowrap colspan=" . ( 0 < $rate0open ? 5 : 4 ) . ">大股东<td nowrap colspan=" . ( 0 < $rate0open ? 4 : 3 ) . ">大股东收飞<td nowrap rowspan=2>总结果<td nowrap rowspan=2>公司";
                    if ($qchkbx)
                    {
                        $reStr .= "<td nowrap rowspan=2>贡献额<td nowrap rowspan=2>贡献度";
                    }
                    $reStr .= "<tr class=" . $trCls . " align=center><td nowrap>退水" . ( 0 < $rate0open ? "<td nowrap>倍差" : "" ) . "<td nowrap>金额<td nowrap>占成<td nowrap>结果<td nowrap>收飞<td nowrap>退水" . ( 0 < $rate0open ? "<td nowrap>倍差" : "" ) . "<td nowrap>结果";
                }
                else
                {
                    $reStr .= "<td nowrap rowspan=2>会员结果<td nowrap rowspan=2>股东交收<td nowrap colspan=" . ( 0 < $rate0open ? 5 : 4 ) . ">大股东<td nowrap rowspan=2>公司";
                    if ($qchkbx)
                    {
                        $reStr .= "<td nowrap rowspan=2>贡献额<td nowrap rowspan=2>贡献度";
                    }
                    $reStr .= "<tr class=" . $trCls . " align=center><td nowrap>退水" . ( 0 < $rate0open ? "<td nowrap>倍差" : "" ) . "<td nowrap>金额<td nowrap>占成<td nowrap>结果";
                }
                $reStr .= "</thead>";
                break;
            case 3 :
                $reStr .= "<tr class=" . $trCls . " align=center>";
                $reStr .= "<td nowrap rowspan=2 width='10%'>总代理帐号名称<td nowrap rowspan=2>笔数<td nowrap rowspan=2>下注金额";
                if ($rate0open)
                {
                    if (0 < $protmod)
                    {
                        $reStr .= "<td nowrap rowspan=2>会员<td nowrap rowspan=2>总代理<td nowrap colspan=5>股东<td nowrap colspan=4>股东收飞<td nowrap rowspan=2>总结果<td nowrap rowspan=2>大股东";
                        if ($qchkbx)
                        {
                            $reStr .= "<td nowrap rowspan=2>贡献额<td nowrap rowspan=2>贡献度";
                        }
                        $reStr .= "<tr class=" . $trCls . " align=center><td nowrap>退水<td nowrap>倍差<td nowrap>金额<td nowrap>占成<td nowrap>结果<td nowrap>收飞<td nowrap>退水<td nowrap>倍差<td nowrap>结果";
                    }
                    else
                    {
                        $reStr .= "<td nowrap rowspan=2>会员<td nowrap rowspan=2>总代理<td nowrap colspan=5>股东<td nowrap rowspan=2>大股东";
                        if ($qchkbx)
                        {
                            $reStr .= "<td nowrap rowspan=2>贡献额<td nowrap rowspan=2>贡献度";
                        }
                        $reStr .= "<tr class=" . $trCls . " align=center><td nowrap>退水<td nowrap>倍差<td nowrap>金额<td nowrap>占成<td nowrap>结果";
                    }
                }
                else if (0 < $protmod)
                {
                    $reStr .= "<td nowrap rowspan=2>会员<td nowrap rowspan=2>总代理<td nowrap colspan=4>股东<td nowrap colspan=3>股东收飞<td nowrap rowspan=2>总结果<td nowrap rowspan=2>大股东";
                    if ($qchkbx)
                    {
                        $reStr .= "<td nowrap rowspan=2>贡献额<td nowrap rowspan=2>贡献度";
                    }
                    $reStr .= "<tr class=" . $trCls . " align=center><td nowrap>退水<td nowrap>金额<td nowrap>占成<td nowrap>结果<td nowrap>收飞<td nowrap>退水<td nowrap>结果";
                }
                else
                {
                    $reStr .= "<td nowrap rowspan=2>会员<td nowrap rowspan=2>总代理<td nowrap colspan=4>股东<td nowrap rowspan=2>大股东";
                    if ($qchkbx)
                    {
                        $reStr .= "<td nowrap rowspan=2>贡献额<td nowrap rowspan=2>贡献度";
                    }
                    $reStr .= "<tr class=" . $trCls . " align=center><td nowrap>退水<td nowrap>金额<td nowrap>占成<td nowrap>结果";
                }
                $reStr .= "</thead>";
                break;
            case 2 :
                $reStr .= "<tr class=" . $trCls . " align=center><td nowrap rowspan=2 width='10%'>代理商帐号名称<td nowrap rowspan=2>" . L_BETCOUNT . "<td nowrap rowspan=2>" . L_BETAMOUNT;
                if ($rate0open)
                {
                    if (0 < $protmod)
                    {
                        $reStr .= "<td nowrap rowspan=2>会员<td nowrap rowspan=2>代理商<td nowrap colspan=5>总代理<td nowrap colspan=4>总代理收飞<td nowrap rowspan=2>总结果<td nowrap rowspan=2>股东";
                        if ($qchkbx)
                        {
                            $reStr .= "<td nowrap rowspan=2>贡献额<td nowrap rowspan=2>贡献度";
                        }
                        $reStr .= "<tr class=" . $trCls . " align=center><td nowrap>退水<td nowrap>倍差<td nowrap>金额<td nowrap>占成<td nowrap>结果<td nowrap>收飞<td nowrap>退水<td nowrap>倍差<td nowrap>结果";
                    }
                    else
                    {
                        $reStr .= "<td nowrap rowspan=2>会员<td nowrap rowspan=2>代理商<td nowrap colspan=5>总代理<td nowrap rowspan=2>股东";
                        if ($qchkbx)
                        {
                            $reStr .= "<td nowrap rowspan=2>贡献额<td nowrap rowspan=2>贡献度";
                        }
                        $reStr .= "<tr class=" . $trCls . " align=center><td nowrap>退水<td nowrap>倍差<td nowrap>金额<td nowrap>占成<td nowrap>结果";
                    }
                }
                else if (0 < $protmod)
                {
                    $reStr .= "<td nowrap rowspan=2>会员<td nowrap rowspan=2>代理商<td nowrap colspan=4>总代理<td nowrap colspan=3>总代理收飞<td nowrap rowspan=2>总结果<td nowrap rowspan=2>股东";
                    if ($qchkbx)
                    {
                        $reStr .= "<td nowrap rowspan=2>贡献额<td nowrap rowspan=2>贡献度";
                    }
                    $reStr .= "<tr class=" . $trCls . " align=center><td nowrap>退水<td nowrap>金额<td nowrap>占成<td nowrap>结果<td nowrap>收飞<td nowrap>退水<td nowrap>结果";
                }
                else
                {
                    $reStr .= "<td nowrap rowspan=2>会员<td nowrap rowspan=2>代理商<td nowrap colspan=4>总代理<td nowrap rowspan=2>股东";
                    if ($qchkbx)
                    {
                        $reStr .= "<td nowrap rowspan=2>贡献额<td nowrap rowspan=2>贡献度";
                    }
                    $reStr .= "<tr class=" . $trCls . " align=center><td nowrap>退水<td nowrap>金额<td nowrap>占成<td nowrap>结果";
                }
                $reStr .= "</thead>";
                break;
            case 1 :
                $reStr .= "<tr class=" . $trCls . " align=center><td nowrap rowspan=2 width='13%'>会员帐号名称<td nowrap rowspan=2 width='10%'>" . L_BETCOUNT . "<td nowrap rowspan=2 width='13%'>" . L_BETAMOUNT;
                $reStr .= "<td nowrap rowspan=2 width='13%'>会员<td nowrap colspan=" . ( 0 < $rate0open ? 5 : 4 ) . " width='41%'>代理商<td nowrap rowspan=2 width='13%'>总代理";
                $reStr .= "<tr class=" . $trCls . " align=center><td nowrap width='8%'>退水";
                $reStr .= $rate0open ? "<td nowrap width='8%'>倍差" : "";
                $reStr .= "<td nowrap width='12%'>金额<td nowrap width='5%'>占成<td nowrap>结果";
                $reStr .= "</thead>";
                break;
            default :
                exit("error show acl");
                break;
        }
    }
    else if ($srcNowShowAcl == 1)
    {
        $reStr .= "<tr class=" . $trCls . " align=center nowrap><td nowrap>下注种类<td nowrap>笔数<td nowrap>下注金额";
        $reStr .= "<td nowrap>会员<td nowrap>占成结果<td nowrap>走飞金额<td nowrap>走飞结果<td nowrap>总结果";
        if ($qchkbx)
        {
            $reStr .= "<td nowrap>贡献额<td nowrap>贡献度";
        }
        $reStr .= "</thead>";
    }
    else if ($srcNowShowAcl < 5)
    {
        $reStr .= "<tr class=" . $trCls . " align=center nowrap><td nowrap width='10%'>下注种类<td nowrap width='5%'>笔数<td nowrap width='10%'>下注金额";
        $reStr .= "<td nowrap width='10%'>会员<td nowrap width='10%'>占成结果<td nowrap width='10%'>收飞占成额<td nowrap width='10%'>收飞占成结果<td nowrap width='10%'>小计<td nowrap width='10%'>走飞金额<td nowrap width='10%'>走飞结果<td nowrap width='10%'>总结果";
        if ($qchkbx)
        {
            $reStr .= "<td nowrap width='7%'>贡献额<td nowrap width='7%'>贡献度";
        }
        $reStr .= "</thead>";
    }
    else
    {
        $reStr .= "<tr class='{$trCls}' align=center nowrap><td nowrap width='7%'>下注种类<td nowrap width='5%'>笔数<td nowrap width='7%'>下注金额";
        $reStr .= "<td nowrap width='7%'>会员<td nowrap width='7%'>管理层<td nowrap width='7%'>公司<td nowrap width='7%'>收飞占成额<td nowrap width='7%'>收飞占成结果<td nowrap width='5%'>总监退水<td nowrap width='7%'>公司小计";
        $reStr .= "<td nowrap width='7%'>走飞金额<td nowrap width='7%'>走飞结果<td nowrap>公司总计结果";
        if ($qchkbx)
        {
            $reStr .= "<td nowrap width='6%'>贡献额<td nowrap width='6%'>贡献度";
        }
        $reStr .= "</thead>";
    }
    return $reStr;
}

if (!defined("IN_OP"))
{
    exit("You can't access this file directly...");
}
$gametype = intval(getvar("gametype"));
$chkGametype = chkGametype($gametype);
if ($chkGametype)
{
    include_once( "class_3d/CheckMode_3d.php" );
    $chk = new CheckMode_3d($curruser['acl'], 1, $gametype);
    $chk->checkShow3dPage();
    $show3D3S = $chk->show3D3S;
    unset($chk);
    $ui = new UI_3D(true, "报表管理");
    $ui->header();
}
else
{
    $ui = new UI(true, "报表管理");
    $show3D3S = 0;
}
if (intval($conf->get("paper_post_flag")))
{
    $ui->showErrorPage("注单备份中，请稍後再使用报表管理功能！");
    exit();
}
$pgMyAcl = $curruser['acl'];
$userid = $curruser['id'];
$pgMyId = $curruser['id'];
$srcId = $curruser['id'];
$title = $aclname[$pgMyAcl];
$tbl = $gametype == 0 ? "" : "_" . $g_gametype_3d[$gametype]['en'];
$tbl2 = $gametype == 0 ? "6h" : $g_gametype_3d[$gametype]['en'];
$tblName = $g_gametype_3d[$gametype]['ch'];
$initStrCalcbet = "calcbet{$tbl}";
$initPaper = "paper_all";
$initUrlGameType = "&gametype={$gametype}";
$decpNum = 3;
$betnameAllArr = array ();
foreach ($g_gametype_3d as $gameid => $val)
{
    if ($gameid == 0)
    {
        $betnameAllArr[0] = $g_betname;
    }
    else
    {
        $betnameAllArr[$gameid] = judge_type($gameid);
    }
}
$betnameShowArr = $betnameAllArr[$gametype];
$gameshow = getVar("gameshow");
$gameshow = $gameshow === "" ? 0 - 1 : intval($gameshow);
$showMyPaperArr = array ();
if ($g_init_mode_6h)
{
    $showMyPaperArr[0] = $g_gametype_3d[0];
}
if ($g_init_mode_3d)
{
    foreach ($g_gametype_3d as $i => $val)
    {
        if ($g_menu_enabled[$i] == 1 && $i)
        {
            $showMyPaperArr[$i] = $g_gametype_3d[$i];
        }
    }
}
else
{
    $gameshow = 0;
}
require_once( "class/function_3d.php" );
$conf = new Config();
if ($conf->get($initStrCalcbet) == 1)
{
    $ui->showErrorPage("{$tblName} 正在颁奖过帐中，请稍後再使用报表管理功能！");
    exit();
}
$rate0open = 1;
$page_max_count = intval($conf->get("page_max_count_ag"));
$paper_show_pn = intval($conf->get("paper_show_pn"));
$paper_post_bet = $conf->get("paper_post_bet");
$paper_from_date = $conf->get("paper_from_date");
if ($paper_from_date == "")
{
    $paper_from_date = date("Y-m-") . "01";
}
$paper_from_dateINT = strtotime($paper_from_date);
$protmod = 0;
if ($paper_post_bet == "")
{
    $paper_post_bet = "0300";
}
if (date("Hi") < $paper_post_bet)
{
    $todayInt = strtotime("-1 day");
    $today = date("Y-m-d", $todayInt);
    $page_max_count = $page_max_count + 1;
    $page_max_day = date("Y-m-d", strtotime("-{$page_max_count} day"));
    $yesDayInt = strtotime("-2 day");
    $yesDay = date("Y-m-d", $yesDayInt);
}
else
{
    $todayInt = time();
    $today = date("Y-m-d", $todayInt);
    $page_max_day = date("Y-m-d", strtotime("-{$page_max_count} day"));
    $yesDayInt = strtotime("-1 day");
    $yesDay = date("Y-m-d", $yesDayInt);
}
$nowShowAclArr = array (2 => 1, 3 => 2, 4 => 3, 5 => 4, 255 => 5);
$nowShowAcl = intval(getvar("nowShowAcl"));
if (!isset($nowShowAclArr[$nowShowAcl]) || $pgMyAcl < $nowShowAcl)
{
    $nowShowAcl = $pgMyAcl;
}
$srcNowShowAcl = $nowShowAclArr[$nowShowAcl];
$srcNowShowAclTitle = $aclname[$srcNowShowAcl];
$title = $aclname[$nowShowAcl];
$dt1 = getvar("dt1");
$showByTime = intval(getvar("showByTime"));
$showSpe255 = false;
$up_user = "";
if ($nowShowAcl == 255)
{
    $rs = getdb("select id from k_user where acl=5 and supe_account='" . $curruser['account'] . "' LIMIT 1");
    if (!$rs->eof)
    {
        $title = "大股东总监";
        $showSpe255 = true;
        $up_user = $curruser['account'];
    }
}
if ($showByTime)
{
    $dtTimeArea = getvar("dtTimeArea");
    if (is_date($dtTimeArea, 1) != false)
    {
        $dt1 = $dtTimeArea;
        $_POST['dt2'] = $dt1;
    }
    else
    {
        $showByTime = 0;
    }
    $lidFlag = false;
    $lid = "";
}
else if (in_array($show3D3S, array (1, 2)))
{
    $lid = getvar("lid");
    $lidFlag = false;
    if ($lid != "")
    {
        $lid = intval($lid);
        $sql = "SELECT open,round,openbet FROM lotto{$tbl} WHERE id={$lid} LIMIT 1";
        $lidRs = getdb($sql);
        if ($lidRs->eof)
        {
            $ui->showErrorPage("{$tblName} 错误的期数ID ", true);
        }
        else
        {
            $dt1 = $lidRs->f[0];
            $_POST['dt2'] = $lidRs->f[0];
            $_3sOpen = $lidRs->f[0];
            $_3sRound = $lidRs->f[1];
            $_3sOpenbet = $lidRs->f[2];
        }
        $lidFlag = true;
        $lidRs->close();
    }
}
else
{
    $lidFlag = false;
    $lid = "";
}
if ($dt1 != "")
{
    $dt1 = is_date($dt1, 1);
    $dt2 = is_date(getvar("dt2"), 1);
    $dt1OLD = $dt1;
    $dt2OLD = $dt2;
    if ($dt1 == false)
    {
        diemsg(L_WRONGDATEFORMAT);
    }
    else if ($dt2 == false)
    {
        diemsg(L_WRONGDATEFORMAT);
    }
    $dt1Int = strtotime($dt1);
    $dt2Int = strtotime($dt2);
    $dtMaxInt = strtotime($page_max_day);
    if ($dt2Int < $dt1Int)
    {
        $dt1Temp = $dt2;
        $dt2 = $dt1;
        $dt1 = $dt1Temp;
        $dt1Temp = $dt2Int;
        $dt2Int = $dt1Int;
        $dt1Int = $dt1Temp;
    }
    if ($todayInt < $dt2Int)
    {
        $dt2 = $today;
        $dt2Int = $todayInt;
    }
    if ($dt1Int < $dtMaxInt)
    {
        $dt1 = $page_max_day;
        $dt1Int = $dtMaxInt;
    }
    if ($dt2Int < $dtMaxInt)
    {
        $dt2 = $page_max_day;
        $dt2Int = $dtMaxInt;
    }
    if ($dt1 == $today && $dt2 == $today)
    {
        $tblX = "";
        $tblTitleDt = "<b>本日帐</b>";
    }
    else
    {
        $tblX = "x";
        $tblTitleDt = "<b>历史帐</b>";
    }
    if ($showByTime)
    {
        $sHours = intval(getvar("sHours"));
        $eHours = intval(getvar("eHours"));
        $sMin = intval(getvar("sMin"));
        $eMin = intval(getvar("eMin"));
        if (23 < $sHours)
        {
            $sHours = 23;
        }
        if (23 < $eHours)
        {
            $eHours = 23;
        }
        $dtTimeS = strtotime($dt1 . " " . $sHours . ":" . $sMin . ":00");
        $dtTimeE = strtotime($dt1 . " " . $eHours . ":" . $eMin . ":00");
        if ($dtTimeS == 0 - 1 || $dtTimeS == 0 - 1)
        {
            $showByTime = 0;
        }
        else
        {
            if ($dtTimeE < $dtTimeS)
            {
                $dtTimeE = $dtTimeE + 86400;
            }
            $dtTimeSstr = date("Y-m-d H:i:s", $dtTimeS);
            $dtTimeEstr = date("Y-m-d H:i:s", $dtTimeE);
        }
    }
    if ($dt1Int < $paper_from_dateINT)
    {
        $ui->showErrorPage("本站仅提供 {$paper_from_date} 後的数据, 如有疑问请联系上级");
    }
    $show_paper_day = intval($conf->get("show_paper_day"));
    if ($show_paper_day != 7 && $curruser['prev_id'] != 0 && $curruser['acl'] == "255" && date("w") != $show_paper_day)
    {
        while (@ob_end_clean())
        {
            
        }
        if (0 < $gametype)
        {
            $ui->header();
        }
        $ui->load("header", "header_3d.htm");
        $ui->show("header");
        echo title("{$title} 报表管理 || 报表日期 {$dt1} ～ {$dt2}", "", 950);
        echo "<br />";
        $ui->load("nopaperData", "nopaperData.htm");
        $ui->show("nopaperData");
        if ($g_init_mode_3d)
        {
            $ui->load("nopaperData", "nopaperData_3d.htm");
            $ui->show("nopaperData");
        }
        $ui->footer();
        $str = ob_get_contents();
        ob_end_clean();
        if ($g_conf['language'] == "zh-cn")
        {
            include_once( "class/ccharset.php" );
            $cc = new CCharset();
            $str = $cc->Big5_Gb($str);
        }
        echo $str;
        exit();
    }
    $papername = array ("", "总帐", "分类帐");
    $bettype = getvar("bettype");
    $betsubID = "";
    $urlSubidA = "";
    $subid = intval(getvar("subid"));
    if ($bettype === "")
    {
        $bettypeStr = "全部";
        $andBettypeSql = "";
    }
    else if (isset($betnameShowArr[$bettype]))
    {
        $betsubID = $bettype;
        $bettypeStr = $betnameShowArr[$bettype];
        $bettypeArr = explode("_", $bettype);
        $bettype = intval($bettypeArr[0]);
        if (isset($bettypeArr[1]))
        {
            $subid = intval($bettypeArr[1]);
            $urlSubidA = "&subid={$subid}";
            $andBettypeSql = "AND bettype = {$bettype} AND subid = {$subid} ";
        }
        else
        {
            $andBettypeSql = "AND bettype = {$bettype}";
            $betsubID = "";
        }
    }
    else if (isset($betnameShowArr["{$bettype}_{$subid}"]))
    {
        $betsubID = "{$bettype}_{$subid}";
        $bettypeStr = $betnameShowArr[$betsubID];
        $andBettypeSql = "AND bettype = {$bettype} AND subid = {$subid} ";
    }
    else
    {
        exit("error bettype");
    }
    $agent = getvar("agent");
    $agent = $agent == "" ? "" : intval($agent);
    $papers = "1";
    $qchkbx = intval(getvar("qchkbx"));
    $totalListArr = array ();
    $totalListFlyArr = array ();
    $disTotalFlag = intval(getvar("disTotalFlag"));
    $totalListIdVsAccount = array ();
    $timeCheck = systime() - 2592000;
    if ($disTotalFlag == 1)
    {
        $showTotalFlag = false;
    }
    else
    {
        $showTotalFlag = true;
    }
    $sum_Rn = 0;
    $flagAcl255 = false;
    $flagAcl2 = false;
    $flagPaperShowPn = false;
    $papers = intval(getvar("papers"));
    if ($papers == 0)
    {
        $papers = 1;
    }
    if ($showSpe255)
    {
        $papers = 1;
    }
    switch ($srcNowShowAcl)
    {
        case 5 :
            $percent6H = "percent4";
            $percent3D = "percent5";
            $rRn = "r6";
            $selBetAmuSQL = "select sum(amount) as amt, sum(b1) as b1,0 as d1, 0 as a, 0 as b2, 0 as c, 0 as d2, 0 as e, sum(r6) as r, count(amount) as cat, sum(r5) as r5, sum(c5) as c5,sum(g5) as g5 ";
            $selBet2AmuSQLA = "select sum(amount*percent255/100) as famt, 0 as fc, 0 as fd2, 0 as fa, 0 as fe, 0 as fd1 ,sum(r6) as fr, count(amount) as fcat, sum(r5) as fr5,sum(g5) as fg5 ";
            $selBet2AmuSQLB = " and uperid5=";
            $selBet2AmuSQLC = "";
            $flagAcl255 = true;
            if ($paper_show_pn)
            {
                $flagPaperShowPn = true;
            }
            break;
        case 4 :
            $percent6H = "percent4";
            $percent3D = "percent5";
            $rRn = "r4";
            $selBetAmuSQL = "select sum(amount) as amt, sum(b1) as b1, sum(d4) as d1, sum(a5) as a, sum(b5) as b2, sum(c5) as c, sum(d5) as d2, sum(e5) as e, sum(r4) as r, count(amount) as cat, 0 as r5, 0 as c5,0 as g5 ";
            $selBet2AmuSQLA = "select sum(amount*percent5/100) as famt, sum(c5) as fc, sum(d5) as fd2, sum(a5) as fa, sum(e5) as fe, sum(d4) as fd1 ,sum(r4) as fr,count(amount) as fcat,0 as fr5,0 as fg5 ";
            $selBet2AmuSQLB = " and uperid5=";
            $selBet2AmuSQLC = " and uperid4=";
            break;
        case 3 :
            $percent6H = "percent3";
            $percent3D = "percent4";
            $rRn = "r3";
            $selBetAmuSQL = "select sum(amount) as amt, sum(b1) as b1, sum(d3) as d1, sum(a4) as a, sum(b4) as b2, sum(c4) as c, sum(d4) as d2, sum(e4) as e, sum(r3) as r, count(amount) as cat ,0 as r5, 0 as c5,0 as g5";
            $selBet2AmuSQLA = "select sum(amount*percent4/100) as famt, sum(c4) as fc, sum(d4) as fd2, sum(a4) as fa, sum(e4) as fe, sum(d3) as fd1 ,sum(r3) as fr,count(amount) as fcat,0 as fr5,0 as fg5 ";
            $selBet2AmuSQLB = " and uperid4=";
            $selBet2AmuSQLC = " and uperid3=";
            break;
        case 2 :
            $percent6H = "percent2";
            $percent3D = "percent3";
            $rRn = "r2";
            $selBetAmuSQL = "select sum(amount) as amt, sum(b1) as b1, sum(d2) as d1, sum(a3) as a, sum(b3) as b2, sum(c3) as c, sum(d3) as d2, sum(e3) as e, sum(r2) as r, count(amount) as cat, 0 as r5, 0 as c5,0 as g5 ";
            $selBet2AmuSQLA = "select sum(amount*percent3/100) as famt, sum(c3) as fc, sum(d3) as fd2, sum(a3) as fa, sum(e3) as fe, sum(b2) as fd1 ,sum(r2) as fr,count(amount) as fcat,0 as fr5,0 as fg5 ";
            $selBet2AmuSQLB = " and uperid3=";
            $selBet2AmuSQLC = " and user_id=";
            break;
        case 1 :
            $percent6H = "mpercent";
            $percent3D = "percent2";
            $selBetAmuSQL = "select sum(amount) as amt, sum(b1) as b1,0 as d1, sum(a2) as a, sum(b2) as b2, sum(c2) as c, sum(d2) as d2, sum(e2) as e, 0 as r, count(amount) as cat , 0 as r5, 0 as c5,0 as g5";
            $selBet2AmuSQLA = "";
            $selBet2AmuSQLB = "";
            $selBet2AmuSQLC = "";
            $flagAcl2 = true;
            break;
        default :
            exit();
            break;
    }
    $allPaperArr = array (
        "0" => array (
            "idx" => "6h",
            "cal" => $conf->get("calcbet"),
            "sys" => $conf->get("systemcheck_6h"),
            "ch" => "六合彩",
            "trCls" => "paper6h",
            "tbl" => "",
            "percentQ" => $percent6H,
            "showtype" => "0",
            "prePage" => "",
            "tblX" => ""
        ),
        "1" => array (
            "idx" => "3d",
            "cal" => $conf->get("calcbet_3d"),
            "sys" => $conf->get("systemcheck_3d"),
            "ch" => "福彩3D",
            "trCls" => "paper3d",
            "tbl" => "_3d",
            "percentQ" => $percent3D,
            "showtype" => "1",
            "prePage" => "_3d",
            "tblX" => $tblX
        ),
        "2" => array (
            "idx" => "3t",
            "cal" => $conf->get("calcbet_3t"),
            "sys" => $conf->get("systemcheck_3t"),
            "ch" => "体彩P3",
            "trCls" => "paper3t",
            "tbl" => "_3t",
            "percentQ" => $percent3D,
            "showtype" => "2",
            "prePage" => "_3d",
            "tblX" => $tblX
        ),
        "10" => array (
            "idx" => "3s1",
            "cal" => 2,
            "sys" => $conf->get("systemcheck_3s1"),
            "ch" => "上海时时乐",
            "trCls" => "paper3s1",
            "tbl" => "_3s1",
            "percentQ" => $percent3D,
            "showtype" => "10",
            "prePage" => "_3d",
            "tblX" => $tblX
        ),
        "11" => array (
            "idx" => "3s2",
            "cal" => 2,
            "sys" => $conf->get("systemcheck_3s2"),
            "ch" => "天津时时彩",
            "trCls" => "paper3s2",
            "tbl" => "_3s2",
            "percentQ" => $percent3D,
            "showtype" => "11",
            "prePage" => "_3d",
            "tblX" => $tblX
        ),
        "12" => array (
            "idx" => "3s3",
            "cal" => 2,
            "sys" => $conf->get("systemcheck_3s3"),
            "ch" => "重庆时时彩",
            "trCls" => "paper3s3",
            "tbl" => "_3s3",
            "percentQ" => $percent3D,
            "showtype" => "12",
            "prePage" => "_3d",
            "tblX" => $tblX
        ),
        "13" => array (
            "idx" => "3s4",
            "cal" => 2,
            "sys" => $conf->get("systemcheck_3s4"),
            "ch" => "江西时时彩",
            "trCls" => "paper3s4",
            "tbl" => "_3s4",
            "percentQ" => $percent3D,
            "showtype" => "13",
            "prePage" => "_3d",
            "tblX" => $tblX
        ),
        "14" => array (
            "idx" => "3s5",
            "cal" => 2,
            "sys" => $conf->get("systemcheck_3s5"),
            "ch" => "新疆时时彩",
            "trCls" => "paper3s5",
            "tbl" => "_3s5",
            "percentQ" => $percent3D,
            "showtype" => "14",
            "prePage" => "_3d",
            "tblX" => $tblX
        ),
        "15" => array (
            "idx" => "3s6",
            "cal" => 2,
            "sys" => $conf->get("systemcheck_3s6"),
            "ch" => "福建时时彩",
            "trCls" => "paper3s6",
            "tbl" => "_3s6",
            "percentQ" => $percent3D,
            "showtype" => "15",
            "prePage" => "_3d",
            "tblX" => $tblX
        ),
        "20" => array (
            "idx" => "5h",
            "cal" => 2,
            "sys" => $conf->get("systemcheck_5h"),
            "ch" => "广西快乐十分",
            "trCls" => "paper5h",
            "tbl" => "_5h",
            "percentQ" => $percent3D,
            "showtype" => "20",
            "prePage" => "_3d",
            "tblX" => $tblX
        ),
        "21" => array (
            "idx" => "8h",
            "cal" => 2,
            "sys" => $conf->get("systemcheck_8h"),
            "ch" => "广东快乐十分",
            "trCls" => "paper8h",
            "tbl" => "_8h",
            "percentQ" => $percent3D,
            "showtype" => "21",
            "prePage" => "_3d",
            "tblX" => $tblX
        ),
        "22" => array (
            "idx" => "8h2",
            "cal" => 2,
            "sys" => $conf->get("systemcheck_8h2"),
            "ch" => "天津快乐十分",
            "trCls" => "paper8h2",
            "tbl" => "_8h2",
            "percentQ" => $percent3D,
            "showtype" => "22",
            "prePage" => "_3d",
            "tblX" => $tblX
        ),
        "23" => array (
            "idx" => "8h3",
            "cal" => 2,
            "sys" => $conf->get("systemcheck_8h3"),
            "ch" => "幸运农场",
            "trCls" => "paper8h3",
            "tbl" => "_8h3",
            "percentQ" => $percent3D,
            "showtype" => "23",
            "prePage" => "_3d",
            "tblX" => $tblX
        ),
        "24" => array (
            "idx" => "pk10",
            "cal" => 2,
            "sys" => $conf->get("systemcheck_pk10"),
            "ch" => "北京快乐赛车",
            "trCls" => "paperpk10",
            "tbl" => "_pk10",
            "percentQ" => $percent3D,
            "showtype" => "24",
            "prePage" => "_3d",
            "tblX" => $tblX
        ),
		"25" => array (
            "idx" => "sb1",
            "cal" => 2,
            "sys" => $conf->get("systemcheck_pk10"),
            "ch" => "江苏骰宝",
            "trCls" => "paper3d",
            "tbl" => "_sb1",
            "percentQ" => $percent3D,
            "showtype" => "25",
            "prePage" => "_3d",
            "tblX" => $tblX
        ),
		"26" => array (
            "idx" => "sb2",
            "cal" => 2,
            "sys" => $conf->get("systemcheck_pk10"),
            "ch" => "安徽骰宝",
            "trCls" => "paper3t",
            "tbl" => "_sb2",
            "percentQ" => $percent3D,
            "showtype" => "26",
            "prePage" => "_3d",
            "tblX" => $tblX
        )
    );
    if ($lidFlag)
    {
        $showTotalFlag = false;
    }
    if ($showTotalFlag && $bettype === "")
    {
        $showALlPaper = true;
        if (isset($_GET['playCheck']))
        {
            $allPaperArrTemp = array ();
            foreach ($_GET['playCheck'] as $val)
            {
                if (isset($showMyPaperArr[$val]))
                {
                    $allPaperArrTemp[$val] = $allPaperArr[$val];
                }
            }
            $showPaperArr = $allPaperArrTemp;
            if (count($allPaperArrTemp) == 1)
            {
                $showALlPaper = false;
            }
        }
        else
        {
            $allPaperArrTemp = array ();
            foreach ($g_menu_enabled as $key => $val)
            {
                if ($val)
                {
                    $allPaperArrTemp[$key] = $allPaperArr[$key];
                }
            }
            if (!$g_init_mode_6h)
            {
                unset($allPaperArrTemp[0]);
            }
            $showPaperArr = $allPaperArrTemp;
            if (count($allPaperArrTemp) == 1)
            {
                $showALlPaper = false;
            }
        }
    }
    else
    {
        $showPaperArr = array ();
        $showALlPaper = false;
        $showPaperArr[0] = $allPaperArr[$gametype];
    }
    $getMemIDFlag = true;
    $getMemRsSql = "";
    $protmodTotal = 0;
    $betRType = intval(getvar("betRType"));
    switch ($betRType)
    {
        case 1 :
            $rameSQLStr = "AND rame = 9 AND (b1 - a1) <= 0 ";
            $rameSQLStr2 = "AND rame = 9 AND (CASE acl WHEN 2 THEN (b2 - a2) WHEN 3 THEN (b3 - a3) WHEN 4 THEN (b4 - a4) WHEN 5 THEN (b5 - a5) ELSE 0 END) <= 0 ";
            $rameSQLStr8 = "AND rame = 9 AND (r5 - back) <= 0 ";
            $rameSQLStr0 = "AND rame = 9 AND (b1 - a1) <= 0";
            $rameSQLStr0_2 = "AND rame = 9 AND (CASE acl WHEN 2 THEN (b2 - a2) WHEN 3 THEN (b3 - a3) WHEN 4 THEN (b4 - a4) WHEN 5 THEN (b5 - a5) ELSE 0 END) <= 0";
            $rameTitleStr = " 选项:上缴";
            break;
        case 2 :
            $rameSQLStr = "AND rame = 9 AND (b1 - a1) > 0 ";
            $rameSQLStr2 = "AND rame = 9 AND (CASE acl WHEN 2 THEN (b2 - a2) WHEN 3 THEN (b3 - a3) WHEN 4 THEN (b4 - a4) WHEN 5 THEN (b5 - a5) ELSE 0 END) > 0 ";
            $rameSQLStr8 = "AND rame = 9 AND (r5 - back) > 0 ";
            $rameSQLStr0 = "AND rame = 9 AND (b1 - a1) > 0";
            $rameSQLStr0_2 = "AND rame = 9 AND (CASE acl WHEN 2 THEN (b2 - a2) WHEN 3 THEN (b3 - a3) WHEN 4 THEN (b4 - a4) WHEN 5 THEN (b5 - a5) ELSE 0 END) > 0";
            $rameTitleStr = " 选项:得分";
            break;
        default :
            $rameSQLStr = "AND rame IN (0,9)";
            $rameSQLStr2 = "AND rame IN (0,9)";
            $rameSQLStr8 = "AND rame IN (0,9) ";
            $rameSQLStr0 = "";
            $rameSQLStr0_2 = "";
            $rameTitleStr = " 选项:全部";
            break;
    }
    if ($agent == "")
    {
        $userid = $curruser['id'];
        $agentURL6H = "";
    }
    else
    {
        $userid = $agent;
        $srcId = intval($agent);
        $agentURL6H = "&agent={$srcId}";
    }
    echo " <style type=\"text/css\"><!-- .td2 A, .td2 A:active, .td2 A:visited, .td2 A:link {text-decoration: none ; color:blue;font-weight: bold;} --></style>";
    $titleStr = "";
    if ($agent != "")
    {
        $rs = getdb("select id, account, name from k_user where acl={$srcNowShowAcl} and id={$agent} LIMIT 1");
        $titleStr .= "{$srcNowShowAclTitle}：{$rs->f[1]} / {$rs->f[2]}";
    }
    $titleStr .= "日期:";
    if ($dt1 != $dt1OLD || $dt2 != $dt2OLD)
    {
        $titleStr .= " <span class=red>注意: 日期区间已经调整</span> ";
    }
    if ($lidFlag)
    {
        $titleStr .= "{$_3sOpen} 第 {$_3sRound} 期&nbsp;开奖时间：{$_3sOpenbet}&nbsp;报表种类：{$papername[$papers]}&nbsp;下注类别：";
    }
    else if ($showByTime)
    {
        $titleStr .= "<b>时间区间 : {$dtTimeSstr} ～ {$dtTimeEstr}</b> - {$tblTitleDt} - &nbsp;报表种类：{$papername[$papers]}&nbsp;下注类别：";
    }
    else
    {
        $titleStr .= "{$dt1} ～ {$dt2} - {$tblTitleDt} - &nbsp;报表种类：{$papername[$papers]}&nbsp;下注类别：";
    }
    if ($bettype !== "" && $papers == "1")
    {
        $titleStr .= $bettypeStr;
    }
    else
    {
        $titleStr .= "全部";
    }
    echo title("{$title} 报表管理  {$titleStr}", "<a href='?op=agent&fp=" . $initPaper . $initUrlGameType . "&nowShowAcl={$srcNowShowAcl}'>查询{$tblName}报表</a> | <a href='#' onclick='window.print()'>列印</a> | <a href='javascript:history.back()'>回上一页</a>", 950);
    $pg_sqlA = "SELECT id, account,name, prev_id, createdt, acl FROM k_user WHERE acl={$srcNowShowAcl} ";
    if ($nowShowAcl == 255)
    {
        if ($agent != "")
        {
            $pg_sqlA .= " and id={$agent}";
        }
        if ($showSpe255 && $srcNowShowAcl == 5)
        {
            $pg_sqlA .= " and supe_account='{$up_user}'";
        }
    }
    else
    {
        $mypaperSrc = intval(getvar("mypaperSrc"));
        if ($pgMyAcl == $srcNowShowAcl)
        {
            $pg_sqlA .= " and prev_id=" . $pgMyId;
        }
        else if ($agent != "")
        {
            $userid = $agent;
            if ($mypaperSrc)
            {
                $pg_sqlA .= " and id=" . $agent;
            }
            else
            {
                $pg_sqlA .= " and prev_id=" . $agent;
            }
        }
        else if ($pgMyAcl != 255)
        {
            $users = getuserlist($pgMyId, $srcNowShowAcl);
            if ($users == "")
            {
                $pg_sqlA .= " and 1=0";
            }
            else
            {
                $pg_sqlA .= " and id in ({$users})";
            }
        }
    }
    $getMemRsSql = $pg_sqlA . " order by account";
    $pgUsersArr = array ();
    $rs = getdb($getMemRsSql);
    $lastlogdtInt = $paper_from_dateINT - 172800;
    while (!$rs->eof)
    {
        $pgUsersArr[] = array (0 => $rs->f, 1 => 1);
        $rs->next();
    }
    $totalListSortArr = array ();
    $t_s_rn = 0;

    foreach ($showPaperArr as $showPaperKey => $showPaperVal)
    {
        if ($showByTime && $showPaperVal['showtype'] < 3)
        {
            continue;
        }
        if ($curruser['acl'] != 255 && $showPaperVal['sys'] == 1)
        {
            echo "<br /><div style=\"width:758px;text-align=center;\" class=\"" . $showPaperVal['trCls'] . "\">------  " . $showPaperVal['ch'] . "系统维謢中，暂不显示相关资料  ------</div>";
            continue;
        }
        if ($showPaperVal['cal'] == 1)
        {
            echo "<br /><div style=\"width:758px;text-align=center;\" class=\"" . $showPaperVal['trCls'] . "\">------  " . $showPaperVal['ch'] . "颁奖过帐中，暂不显示相关资料  ------</div>";
            continue;
        }
        if ($showPaperVal['cal'] == 2)
        {
            if ($conf->get("calcbet_" . $showPaperVal['idx']) == 0)
            {
                $rs = getdb("SELECT open,round FROM lotto" . $showPaperVal['tbl'] . " WHERE open BETWEEN '{$dt1}' AND '{$dt2}' AND calcbet=1 LIMIT 0,1");
                if (!$rs->eof)
                {
                    echo "<br /><div style=\"width:758px;text-align=center;\" class=\"" . $showPaperVal['trCls'] . "\">------  " . $showPaperVal['ch'] . "尚有期数在颁奖过帐中({$rs->f[0]}第{$rs->f[1]}期)，暂不显示相关资料  ------</div>";
                    $rs->close();
                    continue;
                }
            }
        }
        if ($papers != "1")
        {
            $agentURL = $agentURL6H;
        }
        else if ($showPaperKey)
        {
            $agentURL = "";
        }
        else
        {
            $agentURL = $agentURL6H;
        }
        $showPaperVal_tbl = $showPaperVal['tbl'];
        $showPaperVal_pQ = $showPaperVal['percentQ'];
        $showPaperVal_prePage = $showPaperVal['prePage'];
        $showPaperVal_showtype = $showPaperVal['showtype'];
        $tblX = $showPaperVal['tblX'];
        $protmod = getProtmode_3d($userid, $showPaperVal_showtype);
        $protmodTotal += $protmod;
        echo "<br>";
        echo getTblHd($srcNowShowAcl, $showPaperVal['trCls'], $papers, $showPaperVal['ch'], $protmod, $rate0open, $qchkbx);
        if ($papers == "1")
        {
            if ($lidFlag)
            {
                $rs = getdb("select id from lotto{$showPaperVal_tbl} where id={$lid} limit 1");
            }
            else if ($showByTime)
            {
                $rs = getdb("select id from lotto{$showPaperVal_tbl} where open = '{$dt1}' AND openbet between '{$dtTimeSstr}' and '{$dtTimeEstr}'");
            }
            else
            {
                $rs = getdb("select id from lotto{$showPaperVal_tbl} where open between '{$dt1}' and '{$dt2}'");
            }
            $lottosArrTemp = array ();
            $lottos = "";
            while (!$rs->eof)
            {
                $lottosArrTemp[] = $rs->f['id'];
                $rs->movenext();
            }
            $rs->close();
            $lottos = implode(",", $lottosArrTemp);
            $sum_result_rn = 0;
            $sum_result_cat = 0;
            $sum_result_catA = 0;
            $sum_result_amt = 0;
            $sum_result_b1 = 0;
            $sum_result_c5 = 0;
            $sum_result_r5 = 0;
            $sum_result_famt = 0;
            $sum_result_fr5 = 0;
            $sum_result_g5_fg5 = 0;
            $sum_result_r_all = 0;
            $sum_result_rs2f3 = 0;
            $sum_result_e = 0;
            $sum_result_b2 = 0;
            $sum_result_perc = 0;
            $sum_result_c = 0;
            $sum_result_d1 = 0;
            $sum_result_d2 = 0;
            $sum_result_fd2 = 0;
            $sum_result_fd1 = 0;
            $sum_result_rsbf3 = 0;
            $sum_result_fe = 0;
            $sum_result_fc = 0;
            $sum_account = 0;
            if ($lottos != "")
            {
                if ($qchkbx && 1 < $srcNowShowAcl)
                {
                    foreach ($pgUsersArr as $valpgU)
                    {
                        $rsArr = $valpgU[0];
                        $users = $valpgU[1];
                        $usersAcl = $rsArr['acl'];
                        $usersAclId = $rsArr['id'];
                        if ($users != "")
                        {
                            $sqlx = "select sum({$rRn}) from {$tblX}bet{$showPaperVal_tbl} where lotto_id in ({$lottos}) and acl{$usersAcl} = {$usersAclId} {$andBettypeSql} {$rameSQLStr}";
                            $rsx = getdb($sqlx);
                            $sum_result_rn += $rsx->f[0] + 0;
                        }
                        $sqlx = "select sum({$rRn}) from {$tblX}bet2{$showPaperVal_tbl} where lotto_id in ({$lottos}) ";
                        if ($flagAcl255)
                        {
                            $sqlx .= $selBet2AmuSQLB . $rsArr['id'];
                        }
                        else
                        {
                            $sqlx .= $selBet2AmuSQLB . $rsArr['prev_id'] . $selBet2AmuSQLC . $rsArr['id'];
                        }
                        $sqlx .= " {$andBettypeSql} {$rameSQLStr2}";
                        $rsx = getdb($sqlx);
                        $sum_result_rn += $rsx->f[0] + 0;
                        $rsx->close();
                    }
                    $sum_Rn += $sum_result_rn;
                }
                foreach ($pgUsersArr as $valpgU)
                {
                    $users = $valpgU[1];
                    $info = $valpgU[0];
                    $usersAcl = $info['acl'];
                    $usersAclId = $info['id'];
                    if (1 < $usersAcl)
                    {
                        $userSQLadd = "and acl{$usersAcl} = {$usersAclId}";
                    }
                    else
                    {
                        $userSQLadd = "and user_id = {$usersAclId}";
                    }
                    if ($users != "")
                    {
                        $showSQL = "select id from {$tblX}bet{$showPaperVal_tbl} where lotto_id in ({$lottos}) {$userSQLadd} {$rameSQLStr0} {$andBettypeSql} LIMIT 1";
                        $showRS = getdb($showSQL);
                        $this_count = 0;
                        if (!$showRS->eof)
                        {
                            $sql = $selBetAmuSQL;
                            $sql .= $flagAcl255 ? "" : ",sum({$showPaperVal_pQ}) as perc";
                            $sql .= " from {$tblX}bet{$showPaperVal_tbl} where lotto_id in ({$lottos}) {$userSQLadd} {$andBettypeSql} {$rameSQLStr}";
                            $rs2 = getdb($sql);
                            $result_amt = 0;
                            $result_b1 = 0;
                            $result_cat = 0;
                            $result_catA = 0;
                            $result_r5 = 0;
                            $result_c5 = 0;
                            $result_g5 = 0;
                            $result_a = 0;
                            $result_b2 = 0;
                            $result_c = 0;
                            $result_d2 = 0;
                            $result_e = 0;
                            $result_perc = 0;
                            $rs2f3 = 0;
                            $result_d1 = 0;
                            $result_r = 0;
                            $result_r_all = $result_r;
                            $result_amt = intval($rs2->f['amt']);
                            $result_b1 = $rs2->f['b1'];
                            $result_cat = $rs2->f['cat'];
                            ++$sum_account;
                            $result_catA = $result_cat;
                            if (1 < $srcNowShowAcl)
                            {
                                if (!$flagAcl255)
                                {
                                    $result_d1 = $rs2->f['d1'];
                                }
                                $result_r = $rs2->f['r'];
                                $result_r_all = $result_r;
                            }
                            if ($flagAcl255)
                            {
                                if ($flagPaperShowPn)
                                {
                                    $result_r5 = $rs2->f['r5'] * ( 0 - 1 );
                                    $result_c5 = $rs2->f['c5'];
                                }
                                else
                                {
                                    $result_r5 = $rs2->f['r5'];
                                    $result_c5 = $rs2->f['c5'] * ( 0 - 1 );
                                }
                                $result_g5 = $rs2->f['g5'];
                            }
                            else
                            {
                                $result_a = $rs2->f['a'];
                                $result_b2 = $rs2->f['b2'];
                                $result_c = $rs2->f['c'];
                                $result_d2 = $rs2->f['d2'];
                                $result_e = $rs2->f['e'];
                                $result_perc = $rs2->f['perc'];
                                if (1 < $srcNowShowAcl)
                                {
                                    $rs2f3 = 0 < $result_a ? abs($result_d2 + $result_c - $result_d1) : 0;
                                    $rs2f3 = 0 < $rs2f3 ? $rs2f3 - $result_e : $rs2f3;
                                }
                                else
                                {
                                    $rs2f3 = 0 < $result_a ? abs($result_d2 + $result_c - $result_b1) : 0;
                                    $rs2f3 = 0 < $rs2f3 ? $rs2f3 - $result_e : $rs2f3;
                                }
                            }
                            $result_famt = 0;
                            $result_fr5 = 0;
                            $result_fg5 = 0;
                            $result_fc = 0;
                            $result_fd2 = 0;
                            $result_fa = 0;
                            $result_fe = 0;
                            $result_fd1 = 0;
                            $result_fcat = 0;
                            $result_fr = 0;
                            $rsbf3 = 0;
                            if (1 < $srcNowShowAcl)
                            {
                                $sql = "{$selBet2AmuSQLA} from {$tblX}bet2{$showPaperVal_tbl} where lotto_id in ({$lottos}) ";
                                if ($flagAcl255)
                                {
                                    $sql .= $selBet2AmuSQLB . $info['id'];
                                }
                                else
                                {
                                    $sql .= $selBet2AmuSQLB . $info['prev_id'] . $selBet2AmuSQLC . $info['id'];
                                }
                                $sql .= " {$andBettypeSql} {$rameSQLStr2}";
                                $rsb = getdb($sql);
                                if (0 < $rsb->f['fcat'])
                                {
                                    $result_famt = $rsb->f['famt'];
                                    $result_fr = $rsb->f['fr'];
                                    $result_r_all += $result_fr;
                                    $result_catA += $rsb->f['fcat'];
                                    if ($flagAcl255)
                                    {
                                        $result_fr5 = $flagPaperShowPn ? $rsb->f['fr5'] * ( 0 - 1 ) : $rsb->f['fr5'];
                                        $result_fg5 = $rsb->f['fg5'];
                                    }
                                    else
                                    {
                                        $result_fc = $rsb->f['fc'];
                                        $result_fd2 = $rsb->f['fd2'];
                                        $result_fa = $rsb->f['fa'];
                                        $result_fe = $rsb->f['fe'];
                                        $result_fd1 = $rsb->f['fd1'];
                                        $result_fcat = $rsb->f['fcat'];
                                        $rsbf3 = 0 < $result_fa ? abs($result_fd2 + $result_fc - $result_fd1) : 0;
                                        $rsbf3 = 0 < $rsbf3 ? $rsbf3 - $result_fe : $rsbf3;
                                    }
                                }
                            }
                            echo "<tr align=right class=td2>";
                            if ($timeCheck < $info['createdt'])
                            {
                                $tempClass = "td4";
                            }
                            else
                            {
                                $tempClass = "";
                            }
                            echo "<td nowrap align=left class='{$tempClass}'>" . $info['account'];
                            if ($info['name'] != $info['account'])
                            {
                                echo "&#12288;<font color=#1012c6>" . $info['name'] . "</font>";
                            }
                            echo "<td nowrap>" . $result_cat;
                            echo "<td nowrap><a href=\"javascript:paper(" . $info['id'] . ",'" . $showPaperVal['idx'] . "');\">{$result_amt}</a>";
                            echo "<td nowrap>" . say_numbercolor($result_b1, $decpNum);
                            switch ($srcNowShowAcl)
                            {
                                case 5 :
                                    $tempUrl = "?op=agent&fp=bet2list02" . $showPaperVal['prePage'] . "&bettype={$bettype}&num=all&showType=1&dates={$dt1}&datee={$dt2}&ACLID=" . $info['id'] . "&gametype=" . $showPaperVal['showtype'] . "&lid={$lid}&betRType={$betRType}";
                                    echo "<td nowrap>" . say_numbercolor($result_c5, $decpNum);
                                    echo "<td nowrap>" . say_numbercolor($result_r5, $decpNum);
                                    echo "<td nowrap>";
                                    echo 0 < $result_famt ? "<a href={$tempUrl}>" . say_numbercolor($result_famt, 0) . "</a>" : say_numbercolor($result_famt, 0);
                                    echo "<td nowrap>" . say_numbercolor($result_fr5, $decpNum);
                                    echo "<td nowrap>" . say_numbercolor($result_g5 + $result_fg5, $decpNum);
                                    if ($flagPaperShowPn)
                                    {
                                        echo "<td nowrap>" . say_numbercolor($result_r5 + $result_fr5 + ( $result_g5 + $result_fg5 ), $decpNum);
                                    }
                                    else
                                    {
                                        echo "<td nowrap>" . say_numbercolor($result_r5 + $result_fr5 - ( $result_g5 + $result_fg5 ), $decpNum);
                                    }
                                    if ($qchkbx)
                                    {
                                        echo "<td nowrap><font color=green>" . sprintf("%01.0f", $result_r_all) . "</font>";
                                        if (0 < $sum_result_rn)
                                        {
                                            $result_RS = $result_r_all / $sum_result_rn * 100;
                                        }
                                        else
                                        {
                                            $resultRS = 0;
                                        }
                                        if (0 < $result_RS)
                                        {
                                            echo "<td nowrap align=left><img src='image/bar3.gif' height='10' width='" . floor($result_RS / 2) . "'>&nbsp;<font color=green><small>" . sprintf("%.2f", $result_RS) . "%</small></font></td>";
                                        }
                                        else
                                        {
                                            echo "<td nowrap align=left><small>" . sprintf("%.2f", $result_RS) . "%</small></td>";
                                        }
                                    }
                                    break;
                                case 4 :
                                case 3 :
                                case 2 :
                                    echo "<td nowrap>" . say_numbercolor($result_d1 + $result_fd1, $decpNum);
                                    echo "<td nowrap>" . say_numbercolor($rs2f3, 0);
                                    if ($rate0open)
                                    {
                                        echo "<td nowrap>" . say_numbercolor($result_e, 0);
                                    }
                                    echo "<td nowrap>" . say_numbercolor($result_b2, $decpNum);
                                    echo "<td nowrap>" . round(zero(zero($result_perc, $result_cat), 100), 2);
                                    echo "<td nowrap>" . say_numbercolor($result_c, $decpNum);
                                    if (0 < $protmod)
                                    {
                                        $tempUrl = "?op=agent&fp=bet2list02" . $showPaperVal['prePage'] . "&bettype={$bettype}&num=all&showType=1&dates={$dt1}&datee={$dt2}&ACLID=" . $info['id'] . "&gametype=" . $showPaperVal['showtype'] . "&betRType={$betRType}";
                                        echo "<td nowrap>";
                                        echo 0 < $result_famt ? "<a href=\"{$tempUrl}\">" . say_numbercolor($result_famt, 0) . "</a>" : say_numbercolor($result_famt, 0);
                                        echo "<td nowrap>" . say_numbercolor($rsbf3, 0);
                                        if ($rate0open)
                                        {
                                            echo "<td nowrap>" . say_numbercolor($result_fe, 0);
                                        }
                                        echo "<td nowrap>" . say_numbercolor($result_fc, $decpNum);
                                        echo "<td nowrap>" . say_numbercolor($result_c + $result_fc, $decpNum);
                                    }
                                    echo "<td nowrap>" . say_numbercolor($result_d2 + $result_fd2, $decpNum);
                                    if ($qchkbx)
                                    {
                                        if (0 < $sum_result_rn)
                                        {
                                            $resultRS = $result_r_all / $sum_result_rn * 100;
                                        }
                                        else
                                        {
                                            $resultRS = 0;
                                        }
                                        echo "<td nowrap><font color=green>" . sprintf("%01.0f", $result_r_all) . "</font>";
                                        if (0 < $resultRS)
                                        {
                                            echo "<td nowrap align=left><img src='image/bar3.gif' height='10' width='" . floor($resultRS / 2) . "'>&nbsp;<font color=green><small>" . sprintf("%.2f", $resultRS) . "%</small></font></td>";
                                        }
                                        else
                                        {
                                            echo "<td nowrap align=left><font color=green><small>" . sprintf("%.2f", $resultRS) . "%</small></font></td>";
                                        }
                                    }
                                    break;
                                case 1 :
                                    echo "<td nowrap>" . say_numbercolor($rs2f3, 0);
                                    if ($rate0open)
                                    {
                                        echo "<td nowrap>" . say_numbercolor($result_e, 0);
                                    }
                                    echo "<td nowrap>" . say_numbercolor($result_b2, $decpNum);
                                    echo "<td nowrap>" . round(zero(zero($result_perc, $result_cat), 100), 2);
                                    echo "<td nowrap>" . say_numbercolor($result_c, $decpNum);
                                    echo "<td nowrap>" . say_numbercolor($result_d2, $decpNum);
                                    break;
                            }
                            $sum_result_cat += $result_cat;
                            $sum_result_catA += $result_catA;
                            $sum_result_amt += $result_amt;
                            $sum_result_b1 += $result_b1;
                            $sum_result_c5 += $result_c5;
                            $sum_result_r5 += $result_r5;
                            $sum_result_famt += $result_famt;
                            $sum_result_fr5 += $result_fr5;
                            $sum_result_g5_fg5 += $result_g5 + $result_fg5;
                            $sum_result_r_all += $result_r_all;
                            $sum_result_d1 += $result_d1;
                            $sum_result_d2 += $result_d2;
                            $sum_result_fd1 += $result_fd1;
                            $sum_result_fd2 += $result_fd2;
                            $sum_result_rs2f3 += $rs2f3;
                            $sum_result_e += $result_e;
                            $sum_result_b2 += $result_b2;
                            $sum_result_perc += $result_perc;
                            $sum_result_c += $result_c;
                            $sum_result_rsbf3 += $rsbf3;
                            $sum_result_fe += $result_fe;
                            $sum_result_fc += $result_fc;
                            $tempId = $info['id'];
                            if (isset($totalListArr[$tempId]))
                            {
                                $totalListArr[$tempId]['result_cat'] += $result_cat;
                                $totalListArr[$tempId]['result_catA'] += $result_catA;
                                $totalListArr[$tempId]['result_amt'] += $result_amt;
                                $totalListArr[$tempId]['result_b1'] += $result_b1;
                                $totalListArr[$tempId]['result_bx'] += $result_bx;
                                $totalListArr[$tempId]['result_d1'] += $result_d1;
                                $totalListArr[$tempId]['result_a'] += $result_a;
                                $totalListArr[$tempId]['result_b2'] += $result_b2;
                                $totalListArr[$tempId]['result_c'] += $result_c;
                                $totalListArr[$tempId]['result_d2'] += $result_d2;
                                $totalListArr[$tempId]['result_e'] += $result_e;
                                $totalListArr[$tempId]['result_r'] += $result_r;
                                $totalListArr[$tempId]['result_perc'] += $result_perc;
                                $totalListArr[$tempId]['result_rs2f3'] += $rs2f3;
                                $totalListArr[$tempId]['result_fcat'] += $result_fcat;
                                $totalListArr[$tempId]['result_famt'] += $result_famt;
                                $totalListArr[$tempId]['result_fc'] += $result_fc;
                                $totalListArr[$tempId]['result_fd2'] += $result_fd2;
                                $totalListArr[$tempId]['result_fa'] += $result_fa;
                                $totalListArr[$tempId]['result_fe'] += $result_fe;
                                $totalListArr[$tempId]['result_fd1'] += $result_fd1;
                                $totalListArr[$tempId]['result_fcat'] += $result_fcat;
                                $totalListArr[$tempId]['result_fr'] += $result_fr;
                                $totalListArr[$tempId]['result_rsbf3'] += $rsbf3;
                                $totalListArr[$tempId]['result_c5'] += $result_c5;
                                $totalListArr[$tempId]['result_r5'] += $result_r5;
                                $totalListArr[$tempId]['result_fr5'] += $result_fr5;
                                $totalListArr[$tempId]['result_g5_fg5'] += $result_g5 + $result_fg5;
                                $totalListArr[$tempId]['result_r_all'] += $result_r_all;
                            }
                            else
                            {
                                $totalListIdVsAccount[$tempId] = str_pad(strtoupper($info['account']), 20) . $tempId;
                                $totalListArr[$tempId] = array ("account" => $info['account'], "name" => $info['name'], "tempClass" => $tempClass, "result_cat" => $result_cat, "result_catA" => $result_catA, "result_amt" => $result_amt, "result_b1" => $result_b1, "result_d1" => $result_d1, "result_a" => $result_a, "result_b2" => $result_b2, "result_c" => $result_c, "result_d2" => $result_d2, "result_e" => $result_e, "result_r" => $result_r, "result_perc" => $result_perc, "result_rs2f3" => $rs2f3, "result_fcat" => $result_fcat, "result_famt" => $result_famt, "result_fc" => $result_fc, "result_fd2" => $result_fd2, "result_fa" => $result_fa, "result_fe" => $result_fe, "result_fd1" => $result_fd1, "result_fcat" => $result_fcat, "result_fr" => $result_fr, "result_rsbf3" => $rsbf3, "result_c5" => $result_c5, "result_r5" => $result_r5, "result_fr5" => $result_fr5, "result_g5_fg5" => $result_g5 + $result_fg5, "result_r_all" => $result_r_all);
                            }
                        }
                        $showRS->close();
                    }
                }
            }
            echo "<tr class=gtdtotal align=right style='font-weight:bold'>";
            echo "<td align=right>总计{$sum_account}人";
            echo "<td nowrap>{$sum_result_cat}<td nowrap>{$sum_result_amt}<td nowrap>" . say_numbercolor($sum_result_b1, $decpNum);
            switch ($srcNowShowAcl)
            {
                case 5 :
                    echo "<td nowrap>" . say_numbercolor($sum_result_c5, $decpNum);
                    echo "<td nowrap>" . say_numbercolor($sum_result_r5, $decpNum);
                    echo "<td nowrap>" . say_numbercolor($sum_result_famt, 0);
                    echo "<td nowrap>" . say_numbercolor($sum_result_fr5, $decpNum);
                    echo "<td nowrap>" . say_numbercolor($sum_result_g5_fg5, $decpNum);
                    if ($flagPaperShowPn)
                    {
                        echo "<td nowrap>" . say_numbercolor($sum_result_r5 + $sum_result_fr5 + $sum_result_g5_fg5, $decpNum);
                    }
                    else
                    {
                        echo "<td nowrap>" . say_numbercolor($sum_result_r5 + $sum_result_fr5 - $sum_result_g5_fg5, $decpNum);
                    }
                    if ($qchkbx)
                    {
                        echo "<td nowrap><font color=green>" . sprintf("%01.0f", $sum_result_r_all) . "</font>";
                        if (0 < $sum_result_rn)
                        {
                            $result_RS = $sum_result_r_all / $sum_result_rn * 100;
                        }
                        else
                        {
                            $result_RS = 0;
                        }
                        if (0 < $result_RS)
                        {
                            echo "<td nowrap align=left><img src='image/bar3.gif' height='10' width='" . floor($result_RS / 2) . "'>&nbsp;<font color=green><small>" . sprintf("%.2f", $result_RS) . "%</small></font></td>";
                        }
                        else
                        {
                            echo "<td nowrap align=left><small>" . sprintf("%.2f", $result_RS) . "%</small></td>";
                        }
                    }
                    break;
                case 4 :
                case 3 :
                case 2 :
                    echo "<td nowrap>" . say_numbercolor($sum_result_d1 + $sum_result_fd1, $decpNum);
                    echo "<td nowrap>" . say_numbercolor($sum_result_rs2f3, 0);
                    if ($rate0open)
                    {
                        echo "<td nowrap>" . say_numbercolor($sum_result_e, 0);
                    }
                    echo "<td nowrap>" . say_numbercolor($sum_result_b2, $decpNum);
                    echo "<td nowrap>" . round(zero(zero($sum_result_perc, $sum_result_cat), 100), 2);
                    echo "<td nowrap>" . say_numbercolor($sum_result_c, $decpNum);
                    if (0 < $protmod)
                    {
                        echo "<td nowrap>" . say_numbercolor($sum_result_famt, 0);
                        echo "<td nowrap>" . say_numbercolor($sum_result_rsbf3, 0);
                        if ($rate0open)
                        {
                            echo "<td nowrap>" . say_numbercolor($sum_result_fe, 0);
                        }
                        echo "<td nowrap>" . say_numbercolor($sum_result_fc, $decpNum);
                        echo "<td nowrap>" . say_numbercolor($sum_result_c + $sum_result_fc, $decpNum);
                    }
                    echo "<td nowrap>" . say_numbercolor($sum_result_d2 + $sum_result_fd2, $decpNum);
                    if ($qchkbx)
                    {
                        if (0 < $sum_result_rn)
                        {
                            $resultRS = $sum_result_r_all / $sum_result_rn * 100;
                        }
                        else
                        {
                            $resultRS = 0;
                        }
                        echo "<td nowrap><font color=green>" . sprintf("%01.0f", $sum_result_r_all) . "</font>";
                        if (0 < $resultRS)
                        {
                            echo "<td nowrap align=left><img src='image/bar3.gif' height='10' width='" . floor($resultRS / 2) . "'>&nbsp;<font color=green><small>" . sprintf("%.2f", $resultRS) . "%</small></font></td>";
                        }
                        else
                        {
                            echo "<td nowrap align=left><font color=green><small>" . sprintf("%.2f", $resultRS) . "%</small></font></td>";
                        }
                    }
                    break;
                case 1 :
                    echo "<td nowrap>" . say_numbercolor($sum_result_rs2f3, 0);
                    if ($rate0open)
                    {
                        echo "<td nowrap>" . say_numbercolor($sum_result_e, 0);
                    }
                    echo "<td nowrap>" . say_numbercolor($sum_result_b2, $decpNum);
                    echo "<td nowrap>" . round(zero(zero($sum_result_perc, $sum_result_cat), 100), 2);
                    echo "<td nowrap>" . say_numbercolor($sum_result_c, $decpNum);
                    echo "<td nowrap>" . say_numbercolor($sum_result_d2, $decpNum);
                    break;
            }
            echo "</td></tr>";
            if (0 < $protmod && 0 < $sum_result_cat && $lottos != "")
            {
                switch ($srcNowShowAcl)
                {
                    case 5 :
                        $sql = "select sum(amount),sum(r5) from {$tblX}bet8{$showPaperVal_tbl} where lotto_id in ({$lottos}) {$andBettypeSql} {$rameSQLStr8}";
                        $sqlx = " {$tblX}bet8{$showPaperVal_tbl} where lotto_id in ({$lottos}) {$andBettypeSql} {$rameSQLStr8}";
                        break;
                    case 4 :
                        $sql = "select sum(amount),sum(a5),sum(b5),count(amount) from {$tblX}bet2{$showPaperVal_tbl} where lotto_id in ({$lottos}) and user_id={$userid} {$andBettypeSql} {$rameSQLStr2}";
                        $sqlx = "select id from {$tblX}bet2{$showPaperVal_tbl} where lotto_id in ({$lottos}) and user_id={$userid} {$andBettypeSql} {$rameSQLStr0_2} LIMIT 0,1";
                        $srcNowShowAclTitleUP = "公司";
                        break;
                    case 3 :
                        $sql = "select sum(amount),sum(a4),sum(b4),count(amount) from {$tblX}bet2{$showPaperVal_tbl} where lotto_id in ({$lottos}) and user_id={$userid} {$andBettypeSql} {$rameSQLStr2}";
                        $sqlx = "select id from {$tblX}bet2{$showPaperVal_tbl} where lotto_id in ({$lottos}) and user_id={$userid} {$andBettypeSql} {$rameSQLStr0_2} LIMIT 0,1";
                        $srcNowShowAclTitleUP = "大股东";
                        break;
                    case 2 :
                        $sql = "select sum(amount),sum(a3),sum(b3),count(amount) from {$tblX}bet2{$showPaperVal_tbl} where lotto_id in ({$lottos}) and user_id={$userid} {$andBettypeSql} {$rameSQLStr2}";
                        $sqlx = "select id from {$tblX}bet2{$showPaperVal_tbl} where lotto_id in ({$lottos}) and user_id={$userid} {$andBettypeSql} {$rameSQLStr0_2} LIMIT 0,1";
                        $srcNowShowAclTitleUP = "股东";
                        break;
                    case 1 :
                        $sql = "select sum(amount),sum(a2),sum(b2),count(amount) from {$tblX}bet2{$showPaperVal_tbl} where lotto_id in ({$lottos}) and user_id={$userid} {$andBettypeSql} {$rameSQLStr2}";
                        $sqlx = "select id from {$tblX}bet2{$showPaperVal_tbl} where lotto_id in ({$lottos}) and user_id={$userid} {$andBettypeSql} {$rameSQLStr0_2} LIMIT 0,1";
                        $srcNowShowAclTitleUP = "总代理";
                        break;
                }
                if ($flagAcl255)
                {
                    $sum_resultA = $sum_result_r5 + $sum_result_fr5 - $sum_result_g5_fg5;
                    $rst = getdb($sql);
                    if (!$rst->eof && 0 < $rst->f[0])
                    {
                        echo "<tr align=center class=" . $showPaperVal['trCls'] . " ><td nowrap colspan=6 rowspan=2 align=right>" . $showPaperVal['ch'] . " 公司走飞及总结果";
                        echo "<td nowrap>走飞金额<td nowrap>走飞结果<td nowrap>-<td nowrap>公司总计";
                        echo "<tr align=right class=td2 valign=top>";
                        if ($showPaperVal['tbl'] == "")
                        {
                            $tempUrl = "?op=agent&fp=bet8list&c={$sqlx}&betRType={$betRType}";
                        }
                        else
                        {
                            $tempUrl = "?op=admin&fp=bet8list_3d&dates={$dt1}&datee={$dt2}&num=all&bettype={$bettype}&gametype=" . $showPaperVal['showtype'] . "&betRType={$betRType}{$urlSubidA}";
                        }
                        echo "<td nowrap><a href=\"{$tempUrl}\">" . $rst->f[0] . "</a>";
                        echo "<td nowrap>" . say_numbercolor($rst->f[1], $decpNum);
                        echo "<td nowrap>&nbsp;";
                        if ($flagPaperShowPn)
                        {
                            echo "<td nowrap><b>" . say_numbercolor($sum_resultA - $rst->f[1], $decpNum) . "</b>";
                        }
                        else
                        {
                            echo "<td nowrap><b>" . say_numbercolor($sum_resultA + $rst->f[1], $decpNum) . "</b>";
                        }
                        echo "</td></tr>";
                        if (isset($totalListFlyArr['resultA']))
                        {
                            $totalListFlyArr['resultA'] += $sum_resultA;
                            $totalListFlyArr['amount'] += $rst->f[0];
                            $totalListFlyArr['result1'] += $rst->f[1];
                            $totalListFlyArr['resultOK'] += $sum_resultA + $rst->f[1];
                        }
                        else
                        {
                            $totalListFlyArr['resultA'] = $sum_resultA;
                            $totalListFlyArr['amount'] = $rst->f[0];
                            $totalListFlyArr['result1'] = $rst->f[1];
                            $totalListFlyArr['resultOK'] = $sum_resultA + $rst->f[1];
                        }
                    }
                }
                else
                {
                    $rst = getdb($sql);
                    if (!$rst->eof)
                    {
                        $total = $rst->f[0];
                        $backtot = $rst->f[1];
                        $wintot = $rst->f[2];
                        $items = $rst->f[3];
                        $rst = getdb($sqlx);
                        $movenext = !$rst->eof;
                        if ($movenext)
                        {
                            if ($rate0open)
                            {
                                $colTemp = 10;
                            }
                            else
                            {
                                $colTemp = 9;
                            }
                            echo "<tr class=" . $showPaperVal['trCls'] . " align=center><td colspan=" . ( 1 < $srcNowShowAcl ? $colTemp : "4" ) . " rowspan=2 align=right>" . $showPaperVal['ch'] . " {$title} 走飞及总结果</td>";
                            echo "<td nowrap>走飞金额<td nowrap>走飞退水<td nowrap " . ( $rate0open ? "colspan=2" : "" ) . ">走飞结果<td nowrap>{$title}结果 (总计)<td nowrap>{$srcNowShowAclTitleUP}结果 (总计)";
                            echo "<tr class=td2 align=right>";
                            echo "<td align=right nowrap>";
                            if (0 < $total)
                            {
                                $tempBet2List = $showPaperVal['showtype'] == 0 ? "_6h" : "_3d";
                                $tempUrl = "op.php?op=agent&fp=bet2list{$tempBet2List}&showType=0&dates=" . $dt1 . "&datee=" . $dt2 . "&num=all&bettype=" . $bettype . "&ACLID=" . $userid . "&gametype=" . $showPaperVal['showtype'] . "&betRType={$betRType}{$urlSubidA}";
                                echo "<b><a href=\"{$tempUrl}\">" . say_numbercolor($total, 0) . "</a></b>";
                            }
                            else
                            {
                                echo "<b>" . say_numbercolor($total, 0) . "</b>";
                            }
                            echo "</td>";
                            echo "<td><b>" . say_numbercolor($backtot, 0) . "</td>";
                            echo "<td " . ( $rate0open ? "colspan=2" : "" ) . "><b>" . say_numbercolor($wintot, $decpNum) . "</td>";
                            echo "<td><b>" . say_numbercolor($sum_result_c + $sum_result_fc - $wintot, $decpNum) . "</b></td>";
                            echo "<td><b>" . say_numbercolor($sum_result_d2 + $sum_result_fd2 + $wintot, $decpNum) . "</b>";
                            echo "</td></tr>";
                            if (isset($totalListFlyArr['amount']))
                            {
                                $totalListFlyArr['amount'] += $total;
                                $totalListFlyArr['resultB'] += $backtot;
                                $totalListFlyArr['result1'] += $wintot;
                            }
                            else
                            {
                                $totalListFlyArr['amount'] = $total;
                                $totalListFlyArr['resultB'] = $backtot;
                                $totalListFlyArr['result1'] = $wintot;
                            }
                        }
                    }
                }
            }
            echo "</table>";
        }
        else
        {
            if ($lidFlag)
            {
                $rs = getdb("select id from lotto{$showPaperVal_tbl} where id={$lid} limit 1");
            }
            else
            {
                $rs = getdb("select id from lotto{$showPaperVal_tbl} where open between '{$dt1}' and '{$dt2}'");
            }
            $kk = array ();
            $listShow1G = 0;
            if (in_array($showPaperVal_showtype, array (7, 8)))
            {
                $betnameArr = $betnameAllArr[$showPaperVal_showtype];
                $gametypePre = $showPaperVal_showtype == 7 ? "5h" : "8h";
                $strPadChar = "9";
                $gametypeBettypePage = "betlistAll_3d";
                $subidSql = " subid ";
                $subGroupSQL = ", subid";
                $listShow1G = $showPaperVal_showtype;
            }
            else if (0 < $showPaperVal_showtype)
            {
                $betnameArr = $betnameAllArr[$showPaperVal_showtype];
                $gametypePre = "3d";
                $strPadChar = "9";
                $gametypeBettypePage = "betlistAll_3d";
                $subidSql = " subid ";
                $subGroupSQL = ", subid";
            }
            else
            {
                $betnameArr = $betnameAllArr[0];
                $gametypePre = "6h";
                $strPadChar = "0";
                $gametypeBettypePage = "betlist";
                $subidSql = " 0 as subid ";
                $subGroupSQL = "";
            }
            $lottos = "";
            $lottosArrTemp = array ();
            while (!$rs->eof)
            {
                array_push($lottosArrTemp, $rs->f['id']);
                $rs->movenext();
            }
            $lottos = implode(",", $lottosArrTemp);
            $t_amt = 0;
            $t_b1 = 0;
            $t_cat = 0;
            $t_r5 = 0;
            $t_g5 = 0;
            $t_c = 0;
            $t_r = 0;
            $t_famt = 0;
            $t_fr5 = 0;
            $t_fg5 = 0;
            $t_fr = 0;
            $t_fc = 0;
            $t_f2amt = 0;
            $t_f2a = 0;
            $t_f2b = 0;
            $t_f2r5 = 0;
            $t_cQ = 0;
            $t_ap = 0;
            $s_rn = 0;
            $sorti = array ();
            if ($lottos != "")
            {
                if ($flagAcl255)
                {
                    if ($srcId != $pgMyId)
                    {
                        $myUsers = GetUserList($srcId, 1, 1, $lastlogdtInt);
                        $userIdSQL = $myUsers != "" ? " and user_id in ({$myUsers}) " : " and 1 = 0 ";
                    }
                    else
                    {
                        $userIdSQL = "";
                    }
                }
                else if ($srcId != $pgMyId)
                {
                    $myUsers = GetUserList($srcId, 1, 1, $lastlogdtInt);
                    $userIdSQL = $myUsers != "" ? " and user_id in ({$myUsers}) " : " and 1 = 0 ";
                }
                else
                {
                    $myUsers = GetUserList($pgMyId, 1, 1, $lastlogdtInt);
                    $userIdSQL = $myUsers != "" ? " and user_id in ({$myUsers}) " : " and 1 = 0 ";
                }
                $sql = $selBetAmuSQL;
                if ($flagAcl255)
                {
                    $sql .= ", 0 as perc ";
                }
                else
                {
                    $sql .= ",sum({$showPaperVal_pQ}) as perc";
                }
                $sql .= ", bettype, {$subidSql} from {$tblX}bet{$showPaperVal_tbl} where lotto_id in ({$lottos}) {$userIdSQL} {$andBettypeSql} {$rameSQLStr}  GROUP BY bettype {$subGroupSQL}";
                $rsBet = getdb($sql);
                $rsBetArr = array ();
                while (!$rsBet->eof)
                {
                    $betSubIdxTemp = "{$rsBet->f[14]}_{$rsBet->f[15]}";
                    $rsBetArr[$betSubIdxTemp] = $rsBet->f;
                    $s_rn += $rsBet->f[8];
                    $rsBet->next();
                }
                $rsBet2Arr = array ();
                if (1 < $srcNowShowAcl)
                {
                    $sql = "{$selBet2AmuSQLA}, bettype, {$subidSql} from {$tblX}bet2{$showPaperVal_tbl} where lotto_id in ({$lottos}) ";
                    if ($flagAcl255)
                    {
                        if ($srcId != $pgMyId)
                        {
                            $sql .= $selBet2AmuSQLB . $srcId;
                        }
                    }
                    else if ($srcId != $pgMyId)
                    {
                        $sql .= $selBet2AmuSQLB . $srcId . " and uperid{$pgMyAcl} = " . $pgMyId;
                    }
                    else if ($pgMyAcl == 255)
                    {
                        $sql .= " and percent255 > 0 ";
                    }
                    else
                    {
                        $sql .= " and uperid{$pgMyAcl} = " . $srcId . " and user_id <> {$pgMyId} ";
                    }
                    $sql .= " {$andBettypeSql} {$rameSQLStr2} GROUP BY bettype {$subGroupSQL}";
                    $rsBet = getdb($sql);
                    while (!$rsBet->eof)
                    {
                        $betSubIdxTemp = "{$rsBet->f[10]}_{$rsBet->f[11]}";
                        $rsBet2Arr[$betSubIdxTemp] = $rsBet->f;
                        $s_rn += $rsBet->f[6];
                        $rsBet->next();
                    }
                }
                $t_s_rn += $s_rn;
                $rsBet3Arr = array ();
                switch ($srcNowShowAcl)
                {
                    case 5 :
                        $sql = "select sum(amount) as f2amt,0 as f2a, 0 as f2b, sum(r5) as f2r5, bettype, {$subidSql} from {$tblX}bet8{$showPaperVal_tbl} where lotto_id in ({$lottos}) {$andBettypeSql} {$rameSQLStr8} GROUP BY bettype {$subGroupSQL}";
                        $sqlx = " {$tblX}bet8{$showPaperVal_tbl} where lotto_id in ({$lottos}) {$andBettypeSql} {$rameSQLStr8}";
                        break;
                    case 4 :
                        $sql = "select sum(amount) as f2amt,sum(a5) as f2a,sum(b5) as f2b, 0 as f2r5, bettype, {$subidSql} from {$tblX}bet2{$showPaperVal_tbl} where lotto_id in ({$lottos}) and user_id={$userid} {$andBettypeSql} {$rameSQLStr2} GROUP BY bettype {$subGroupSQL}";
                        $sqlx = "select id from {$tblX}bet2{$showPaperVal_tbl} where lotto_id in ({$lottos}) and user_id={$userid} {$andBettypeSql} {$rameSQLStr0_2}";
                        break;
                    case 3 :
                        $sql = "select sum(amount) as f2amt,sum(a4) as f2a,sum(b4) as f2b, 0 as f2r5, bettype, {$subidSql} from {$tblX}bet2{$showPaperVal_tbl} where lotto_id in ({$lottos}) and user_id={$userid} {$andBettypeSql} {$rameSQLStr2} GROUP BY bettype {$subGroupSQL}";
                        $sqlx = "select id from {$tblX}bet2{$showPaperVal_tbl} where lotto_id in ({$lottos}) and user_id={$userid} {$andBettypeSql} {$rameSQLStr0_2}";
                        break;
                    case 2 :
                        $sql = "select sum(amount) as f2amt,sum(a3) as f2a,sum(b3) as f2b, 0 as f2r5, bettype, {$subidSql} from {$tblX}bet2{$showPaperVal_tbl} where lotto_id in ({$lottos}) and user_id={$userid} {$andBettypeSql} {$rameSQLStr2} GROUP BY bettype {$subGroupSQL}";
                        $sqlx = "select id from {$tblX}bet2{$showPaperVal_tbl} where lotto_id in ({$lottos}) and user_id={$userid} {$andBettypeSql} {$rameSQLStr0_2}";
                        break;
                    case 1 :
                        $sql = "select sum(amount) as f2amt,sum(a2) as f2a,sum(b2) as f2b, 0 as f2r5, bettype, {$subidSql} from {$tblX}bet2{$showPaperVal_tbl} where lotto_id in ({$lottos}) and user_id={$userid} {$andBettypeSql} {$rameSQLStr2} GROUP BY bettype {$subGroupSQL}";
                        $sqlx = "select id from {$tblX}bet2{$showPaperVal_tbl} where lotto_id in ({$lottos}) and user_id={$userid} {$andBettypeSql} {$rameSQLStr0_2}";
                        break;
                }
                $rsBet = getdb($sql);
                while (!$rsBet->eof)
                {
                    $betSubIdxTemp = "{$rsBet->f[4]}_{$rsBet->f[5]}";
                    $rsBet3Arr[$betSubIdxTemp] = $rsBet->f;
                    $rsBet->next();
                }
                $rsBet->close();
                foreach ($betnameArr as $betnameArrKey => $betnameArrVal)
                {
                    $keyArrTemp = explode("_", $betnameArrKey);
                    $k = $keyArrTemp[0];
                    $littleTitle = $betnameArrVal;
                    if (isset($keyArrTemp[1]))
                    {
                        $showsubid = intval($keyArrTemp[1]);
                        $urlSubid = "&subid={$showsubid}";
                        if ($g_5number_3d && in_array($k, $g_n3n5Arr) && $showsubid == 0)
                        {
                            $littleTitle = $g_betname_3d[$k] . "(後三)";
                        }
                    }
                    else
                    {
                        $showsubid = 0;
                        $urlSubid = "";
                    }
                    $betSubIdx = "{$k}_{$showsubid}";
                    $tempId = "{$gametypePre}{$betnameArrKey}";
                    $sorti[] = $tempId;
                    if (!isset($rsBetArr[$betSubIdx]))
                    {
                        if (0 < $showPaperVal_showtype)
                        {
                            continue;
                        }
                        $rsBetArr[$betSubIdx] = array (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, $k, $showsubid);
                    }
                    if (!isset($rsBet2Arr[$betSubIdx]))
                    {
                        $rsBet2Arr[$betSubIdx] = array (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, $k, $showsubid);
                    }
                    if (!isset($rsBet3Arr[$betSubIdx]))
                    {
                        $rsBet3Arr[$betSubIdx] = array (0, 0, 0, 0, $k, $showsubid);
                    }
                    $sArr = $rsBetArr[$betSubIdx];
                    $s2Arr = $rsBet2Arr[$betSubIdx];
                    $s3Arr = $rsBet3Arr[$betSubIdx];
                    if (0 < $sArr[9])
                    {
                        $amt = $sArr[0];
                        $b1 = $sArr[1];
                        $d1 = $sArr[2];
                        $a = $sArr[3];
                        $b2 = $sArr[4];
                        $c = $sArr[5];
                        $d2 = $sArr[6];
                        $e = $sArr[7];
                        $r = $sArr[8];
                        $cat = $sArr[9];
                        $r5 = $flagPaperShowPn ? $sArr[10] * ( 0 - 1 ) : $sArr[10];
                        $c5 = $sArr[11] * ( 0 - 1 );
                        $g5 = $sArr[12];
                        $perc = $sArr[13];
                        $cQ = 0;
                    }
                    else
                    {
                        $amt = 0;
                        $b1 = 0;
                        $d1 = 0;
                        $a = 0;
                        $b2 = 0;
                        $c = 0;
                        $d2 = 0;
                        $e = 0;
                        $r = 0;
                        $cat = 0;
                        $r5 = 0;
                        $c5 = 0;
                        $g5 = 0;
                        $perc = 0;
                        $cQ = 0;
                    }
                    $t_cat += $cat;
                    echo "<tr align=right class=td2>";
                    echo "<td width='11%' align=left nowrap>{$betnameArrVal}</td>";
                    echo "<td nowrap>{$cat}</td>";
                    echo "<td nowrap><a href=\"op.php?op=agent&fp=betlist{$showPaperVal_prePage}&dt1={$dt1}&dt2={$dt2}&dates={$dt1}&datee={$dt2}&bettype={$k}&gametype={$showPaperVal_showtype}&num=all&backpage=1&lid={$lid}&betRType={$betRType}{$urlSubid}{$agentURL}&srcNowShowAcl={$srcNowShowAcl}\">{$amt}</a></td>";
                    if (0 < $s2Arr[0])
                    {
                        $famt = $s2Arr[0];
                        $fc = $s2Arr[1];
                        $fd2 = $s2Arr[2];
                        $fa = $s2Arr[3];
                        $fe = $s2Arr[4];
                        $fd1 = $s2Arr[5];
                        $fr = $s2Arr[6];
                        $fcat = $s2Arr[7];
                        $fr5 = $flagPaperShowPn ? $s2Arr[8] * ( 0 - 1 ) : $s2Arr[8];
                        $fg5 = $s2Arr[9];
                    }
                    else
                    {
                        $famt = 0;
                        $fc = 0;
                        $fd2 = 0;
                        $fa = 0;
                        $fe = 0;
                        $fd1 = 0;
                        $fr = 0;
                        $fcat = 0;
                        $fr5 = 0;
                        $fg5 = 0;
                    }
                    if (0 < $s3Arr[0])
                    {
                        $f2amt = $s3Arr[0];
                        $f2a = $s3Arr[1];
                        $f2b = $s3Arr[2];
                        $f2r5 = $s3Arr[3];
                    }
                    else
                    {
                        $f2amt = 0;
                        $f2a = 0;
                        $f2b = 0;
                        $f2r5 = 0;
                    }
                    if (0 < $s_rn)
                    {
                        $ap = ( $r + $fr ) / $s_rn * 100;
                    }
                    else
                    {
                        $ap = 0;
                    }
                    if ($flagPaperShowPn)
                    {
                        $cQ = ( $r5 - $b1 ) * ( 0 - 1 );
                    }
                    else
                    {
                        $cQ = ( $r5 * ( 0 - 1 ) - $b1 ) * ( 0 - 1 );
                    }
                    echo "<td nowrap>" . say_numbercolor($b1, $decpNum);
                    if ($flagAcl255)
                    {
                        $tempUrl = "op.php?op=agent&fp=bet2list02{$showPaperVal_prePage}&bettype={$k}&subid={$showsubid}&num=all&showType=1&dates={$dt1}&datee={$dt2}&ACLID={$srcId}&gametype={$showPaperVal_showtype}&lid={$lid}&betRType={$betRType}";
                        if (0 < $famt)
                        {
                            $tmpStr = "<a href=\"{$tempUrl}\">" . say_numbercolor($famt, $decpNum) . "</a>";
                        }
                        else
                        {
                            $tmpStr = say_numbercolor($famt, $decpNum);
                        }
                        echo "<td nowrap>" . say_numbercolor($cQ, $decpNum) . "</td>";
                        echo "<td nowrap>" . say_numbercolor($r5, $decpNum) . "</td>";
                        echo "<td nowrap>{$tmpStr}</td>";
                        echo "<td nowrap>" . say_numbercolor($fr5, $decpNum) . "</td>";
                        echo "<td nowrap>" . say_numbercolor($g5 + $fg5, $decpNum) . "</td>";
                        if ($flagPaperShowPn)
                        {
                            $totalTemp = $r5 + $fr5 + $g5 + $fg5;
                        }
                        else
                        {
                            $totalTemp = $r5 + $fr5 - $g5 - $fg5;
                        }
                        echo "<td nowrap>" . say_numbercolor($totalTemp, $decpNum) . "</td>";
                        if ($showPaperVal_tbl == "")
                        {
                            $tempUrl = "?op=agent&fp=bet8list&c={$sqlx} and bettype = {$k}&betRType={$betRType}";
                        }
                        else
                        {
                            $tempUrl = "?op=admin&fp=bet8list{$showPaperVal_prePage}&dates={$dt1}&datee={$dt2}&num=all&bettype={$bettype}&gametype=" . $showPaperVal['showtype'] . "&betRType={$betRType}{$urlSubidA}";
                        }
                        if (0 < $f2amt)
                        {
                            $tmpStr = "<a href='{$tempUrl}'>" . say_numbercolor($f2amt, $decpNum) . "</a>";
                        }
                        else
                        {
                            $tmpStr = say_numbercolor($f2amt, $decpNum);
                        }
                        echo "<td nowrap>{$tmpStr}</td>";
                        echo "<td nowrap>" . say_numbercolor($f2r5, $decpNum) . "</td>";
                        if ($flagPaperShowPn)
                        {
                            echo "<td nowrap>" . say_numbercolor($totalTemp - $f2r5, $decpNum) . "</td>";
                        }
                        else
                        {
                            echo "<td nowrap>" . say_numbercolor($totalTemp + $f2r5, $decpNum) . "</td>";
                        }
                    }
                    else
                    {
                        echo "<td nowrap>" . say_numbercolor($c, $decpNum) . "</td>";
                        if (1 < $srcNowShowAcl)
                        {
                            echo "<td nowrap>" . say_numbercolor($famt, $decpNum) . "</td>";
                            echo "<td nowrap>" . say_numbercolor($fc, $decpNum) . "</td>";
                            echo "<td nowrap>" . say_numbercolor($c + $fc, $decpNum);
                        }
                        echo "<td nowrap>" . say_numbercolor($f2amt, $decpNum) . "</td>";
                        echo "<td nowrap>" . say_numbercolor($f2b, $decpNum) . "</td>";
                        echo "<td nowrap>" . say_numbercolor($c + $fc - $f2b, $decpNum) . "</td>";
                    }
                    if ($qchkbx)
                    {
                        echo "<td nowrap><font color=green>" . sprintf("%01.0f", $r + $fr) . "</font>";
                        if (0 < $ap)
                        {
                            echo "<td nowrap align=left><img src='image/bar3.gif' height='10' width='" . floor($ap / 2) . "'>&nbsp;<font color=green><small>" . sprintf("%.2f", $ap) . "%</small></font></td>";
                        }
                        else
                        {
                            echo "<td nowrap align=left><font color=green><small>" . sprintf("%.2f", $ap) . "%</small></font></td>";
                        }
                    }
                    $t_amt += $amt;
                    $t_b1 += $b1;
                    $t_cQ += $cQ;
                    $t_r5 += $r5;
                    $t_g5 += $g5;
                    $t_ap += $ap;
                    $t_c += $c;
                    $t_r += $r;
                    $t_famt += $famt;
                    $t_fr5 += $fr5;
                    $t_fg5 += $fg5;
                    $t_fr += $fr;
                    $t_fc += $fc;
                    $t_f2amt += $f2amt;
                    $t_f2a += $f2a;
                    $t_f2b += $f2b;
                    $t_f2r5 += $f2r5;
                    $tempId = "{$gametypePre}{$betnameArrKey}";
                    if (isset($totalListArr[$tempId]))
                    {
                        $totalListArr[$tempId]["cat"] += $t_cat;
                        $totalListArr[$tempId]["amt"] += $t_amt;
                        $totalListArr[$tempId]["b1"] += $t_b1;
                        $totalListArr[$tempId]["cQ"] += $t_cQ;
                        $totalListArr[$tempId]["r5"] += $t_r5;
                        $totalListArr[$tempId]["g5"] += $t_g5;
                        $totalListArr[$tempId]["ap"] += $t_ap;
                        $totalListArr[$tempId]["c"] += $t_c;
                        $totalListArr[$tempId]["r"] += $t_r;
                        $totalListArr[$tempId]["famt"] += $t_famt;
                        $totalListArr[$tempId]["fr5"] += $t_fr5;
                        $totalListArr[$tempId]["fg5"] += $t_fg5;
                        $totalListArr[$tempId]["fr"] += $t_fr;
                        $totalListArr[$tempId]["fc"] += $t_fc;
                        $totalListArr[$tempId]["f2amt"] += $t_f2amt;
                        $totalListArr[$tempId]["f2a"] += $t_f2a;
                        $totalListArr[$tempId]["f2b"] += $t_f2b;
                        $totalListArr[$tempId]["f2r5"] += $t_f2r5;
                    }
                    else
                    {
                        $totalListSortArr[] = $tempId;
                        $totalListArr[$tempId] = array ("betlistPage" => $gametypeBettypePage, "kname" => $littleTitle, "bettype" => $k, "subid" => $showsubid, "listShow1G" => $listShow1G, "cat" => $cat, "amt" => $amt, "b1" => $b1, "cQ" => $cQ, "r5" => $r5, "g5" => $g5, "ap" => $ap, "c" => $c, "r" => $r, "famt" => $famt, "fr5" => $fr5, "fg5" => $fg5, "fr" => $fr, "fc" => $fc, "f2amt" => $f2amt, "f2a" => $f2a, "f2b" => $f2b, "f2r5" => $f2r5);
                    }
                }
            }
            echo "<tr class=td3 align=right style='font-weight:bold'>";
            echo "<td colspan=1 align=right>总计</td>";
            echo "<td nowrap>{$t_cat}</td>";
            echo "<td nowrap>{$t_amt}</td>";
            echo "<td nowrap>" . say_numbercolor($t_b1, $decpNum) . "</td>";
            if ($flagAcl255)
            {
                echo "<td nowrap>" . say_numbercolor($t_cQ, $decpNum) . "</td>";
                echo "<td nowrap>" . say_numbercolor($t_r5, $decpNum) . "</td>";
                echo "<td nowrap>" . say_numbercolor($t_famt, $decpNum) . "</td>";
                echo "<td nowrap>" . say_numbercolor($t_fr5, $decpNum) . "</td>";
                echo "<td nowrap>" . say_numbercolor($t_fg5 + $t_g5, $decpNum) . "</td>";
                if ($flagPaperShowPn)
                {
                    $totalTemp = $t_r5 + $t_fr5 + $t_g5 + $t_fg5;
                }
                else
                {
                    $totalTemp = $t_r5 + $t_fr5 - $t_g5 - $t_fg5;
                }
                echo "<td nowrap>" . say_numbercolor($totalTemp, $decpNum) . "</td>";
                echo "<td nowrap>" . say_numbercolor($t_f2amt, $decpNum) . "</td>";
                echo "<td nowrap>" . say_numbercolor($t_f2r5, $decpNum) . "</td>";
                if ($flagPaperShowPn)
                {
                    echo "<td nowrap>" . say_numbercolor($totalTemp - $t_f2r5, $decpNum) . "</td>";
                }
                else
                {
                    echo "<td nowrap>" . say_numbercolor($totalTemp + $t_f2r5, $decpNum) . "</td>";
                }
            }
            else
            {
                echo "<td nowrap>" . say_numbercolor($t_c, $decpNum) . "</td>";
                if (1 < $srcNowShowAcl)
                {
                    echo "<td nowrap>" . say_numbercolor($t_famt, $decpNum) . "</td>";
                    echo "<td nowrap>" . say_numbercolor($t_fc, $decpNum) . "</td>";
                    echo "<td nowrap>" . say_numbercolor($t_c + $t_fc, $decpNum) . "</td>";
                }
                echo "<td nowrap>" . say_numbercolor($t_f2amt, $decpNum) . "</td>";
                echo "<td nowrap>" . say_numbercolor($t_f2b, $decpNum) . "</td>";
                echo "<td nowrap>" . say_numbercolor($t_c + $t_fc - $t_f2b, $decpNum) . "</td>";
            }
            if ($qchkbx)
            {
                if (0 < $s_rn)
                {
                    $t_ap = ( $t_r + $t_fr ) / $s_rn * 100;
                }
                else
                {
                    $t_ap = 0;
                }
                echo "<td nowrap><b><font color=green>" . sprintf("%.0f", $s_rn) . "</font></b><td nowrap align=left>" . "<img src='image/bar3.gif' height='10' width='" . floor($t_ap / 2) . "'>&nbsp;<b><font color=green><small>" . sprintf("%.2f", $t_ap) . "%</small></font></b>";
            }
        }
        echo "</table>";
    }
    echo "<form name=f method=get action='op.php'>";
    foreach ($showPaperArr as $key => $val)
    {
        echo "<input type=hidden name='playCheck[]' value='{$key}'>";
    }
    if ($srcNowShowAcl == 1)
    {
        $listTemp3 = "betlist_3d";
        $listTemp5h = "betlist_3d";
        $listTemp6 = "betlist";
        $listTempAll = "true";
    }
    else
    {
        $listTemp3 = "paper_all";
        $listTemp6 = "paper_all";
        $listTemp5h = "paper_all";
        $listTempAll = "false";
    }
    echo "<input type=hidden name=op value=agent>\r\n\t\t<input type=hidden name=fp value=''>\r\n\t\t<input type=hidden name=agent>\r\n\t\t<input type=hidden name=dt1 value='{$dt1}'>\r\n\t\t<input type=hidden name=dt2 value='{$dt2}'>\r\n\t\t<input type=hidden name=dates value='{$dt1}'>\r\n\t\t<input type=hidden name=datee value='{$dt2}'>\r\n\t\t<input type=hidden name=papers value='{$papers}'>\r\n\t\t<input type=hidden name=bettype value='{$bettype}'>\r\n\t\t<input type=hidden name=subid value='{$subid}'>\r\n\t\t<input type=hidden name=disTotalFlag value='1'>\r\n\t\t<input type=hidden name=lid value='{$lid}'>\r\n\t\t<input type=hidden name=gametype value=''>\r\n    <input type=hidden name=qchkbx value='{$qchkbx}'>\r\n    <input type=hidden name=betRType value='{$betRType}'>\r\n    <input type=hidden name=nowShowAcl value='{$srcNowShowAcl}'>\r\n    </form>\r\n\t\t<script>\r\n\t\tfunction paper(subid,gtype)\r\n\t\t{";
    if ($showByTime)
    {
        echo " alert('查询时间区间，只开放第一页查询'); return; ";
    }
    else
    {
        echo "switch(gtype){\r\n      case '6h': f.fp.value='{$listTemp6}';f.gametype.value ='0';break;\r\n      case '3d': f.fp.value='{$listTemp3}';f.gametype.value=1; break;\r\n      case '3t': f.fp.value='{$listTemp3}';f.gametype.value=2; break;\r\n      case '3s1':f.fp.value='{$listTemp3}'; f.gametype.value=10; break;\r\n      case '3s2':f.fp.value='{$listTemp3}'; f.gametype.value=11; break;\r\n      case '3s3':f.fp.value='{$listTemp3}'; f.gametype.value=12; break;\r\n case '3s4':f.fp.value='{$listTemp3}'; f.gametype.value=13; break;\r\n case '3s5':f.fp.value='{$listTemp3}'; f.gametype.value=14; break;\r\n      case '5h':f.fp.value='{$listTemp5h}'; f.gametype.value=20; break;\r\n      case '8h':f.fp.value='{$listTemp5h}'; f.gametype.value=21; break;\r\n case '8h2':f.fp.value='{$listTemp5h}'; f.gametype.value=22; break;\r\n case '8h3':f.fp.value='{$listTemp5h}'; f.gametype.value=23; break;\r\n case 'pk10':f.fp.value='{$listTemp5h}'; f.gametype.value=24; break;\r\n  case 'sb1':f.fp.value='{$listTemp5h}'; f.gametype.value=25; break;\r\n  case 'sb2':f.fp.value='{$listTemp5h}'; f.gametype.value=26; break;\r\n    defalut:return false;\r\n      }\r\n      if((f.disTotalFlag.value ==0) && {$listTempAll}) f.fp.value='betlistAll_3d';\r\n      f.agent.value = subid;\r\n\t\t\tf.submit();";
    }
    echo "\r\n\t\t}\r\n\t\t\r\n\t\tfunction paper2(subid,gtype)\r\n\t\t{ ";
    if ($showByTime)
    {
        echo " alert('查询时间区间，只开放第一页查询'); return;";
    }
    else
    {
        echo "\r\n       f.disTotalFlag.value =0;\r\n\t\t\t paper(subid,gtype);\r\n      ";
    }
    echo "\r\n\t\t}\r\n\t\t</script>";
    if ($showALlPaper)
    {
        echo "<br>";
        echo getTblHd($srcNowShowAcl, "paperAll", $papers, "整合报表", $protmodTotal, $rate0open, $qchkbx);
        if ($papers == "1")
        {
            $sum_result_rn = 0;
            $sum_result_cat = 0;
            $sum_result_amt = 0;
            $sum_result_b1 = 0;
            $sum_result_c5 = 0;
            $sum_result_r5 = 0;
            $sum_result_famt = 0;
            $sum_result_fr5 = 0;
            $sum_result_g5_fg5 = 0;
            $sum_result_r_all = 0;
            $sum_result_rs2f3 = 0;
            $sum_result_e = 0;
            $sum_result_b2 = 0;
            $sum_result_perc = 0;
            $sum_result_c = 0;
            $sum_result_d1 = 0;
            $sum_result_d2 = 0;
            $sum_result_fd2 = 0;
            $sum_result_fd1 = 0;
            $sum_result_rsbf3 = 0;
            $sum_result_fe = 0;
            $sum_result_fc = 0;
            $sum_account = 0;
            sort($totalListIdVsAccount);
            foreach ($totalListIdVsAccount as $theVal)
            {
                $tempKey = substr($theVal, 20);
                $valArr = $totalListArr[$tempKey];
                ++$sum_account;
                echo "<tr class=td2 align=right>";
                echo "<td nowrap align=left class='" . $valArr['tempClass'] . "'>" . $valArr['account'];
                if ($valArr['name'] != $valArr['account'])
                {
                    echo "&#12288;<font color=#1012c6>" . $valArr['name'] . "</font>";
                }
                echo "</td>";
                echo "<td nowrap>" . $valArr['result_cat'] . "</td>";
                if (0 < $valArr['result_amt'])
                {
                    echo "<td nowrap><a href=\"javascript:paper2('{$tempKey}','" . $showPaperVal['idx'] . "');\">" . say_numbercolor($valArr['result_amt'], 0) . "</a></td>";
                }
                else
                {
                    echo "<td nowrap>" . say_numbercolor($valArr['result_amt'], 0) . "</td>";
                }
                echo "<td nowrap>" . say_numbercolor($valArr['result_b1'], $decpNum);
                switch ($srcNowShowAcl)
                {
                    case 5 :
                        echo "<td nowrap>" . say_numbercolor($valArr['result_c5'], $decpNum);
                        echo "<td nowrap>" . say_numbercolor($valArr['result_r5'], $decpNum);
                        echo "<td nowrap>" . say_numbercolor($valArr['result_famt'], 0);
                        echo "<td nowrap>" . say_numbercolor($valArr['result_fr5'], $decpNum);
                        echo "<td nowrap>" . say_numbercolor($valArr['result_g5_fg5'], $decpNum);
                        if ($flagPaperShowPn)
                        {
                            echo "<td nowrap>" . say_numbercolor($valArr['result_r5'] + $valArr['result_fr5'] + $valArr['result_g5_fg5'], $decpNum);
                        }
                        else
                        {
                            echo "<td nowrap>" . say_numbercolor($valArr['result_r5'] + $valArr['result_fr5'] - $valArr['result_g5_fg5'], $decpNum);
                        }
                        if ($qchkbx)
                        {
                            echo "<td nowrap><font color=green>" . sprintf("%01.0f", $valArr['result_r_all']) . "</font>";
                            if (0 < $sum_Rn)
                            {
                                $result_RS = $valArr['result_r_all'] / $sum_Rn * 100;
                            }
                            else
                            {
                                $result_RS = 0;
                            }
                            if (0 < $result_RS)
                            {
                                echo "<td nowrap align=left><img src='image/bar3.gif' height='10' width='" . floor($result_RS / 2) . "'>&nbsp;<font color=green><small>" . sprintf("%.2f", $result_RS) . "%</small></font></td>";
                            }
                            else
                            {
                                echo "<td nowrap align=left><small>" . sprintf("%.2f", $result_RS) . "%</small></td>";
                            }
                        }
                        break;
                    case 4 :
                    case 3 :
                    case 2 :
                        echo "<td nowrap>" . say_numbercolor($valArr['result_d1'] + $valArr['result_fd1'], $decpNum);
                        echo "<td nowrap>" . say_numbercolor($valArr['result_rs2f3'], 0);
                        if ($rate0open)
                        {
                            echo "<td nowrap>" . say_numbercolor($valArr['result_e'], 0);
                        }
                        echo "<td nowrap>" . say_numbercolor($valArr['result_b2'], $decpNum);
                        echo "<td nowrap>" . round(zero(zero($valArr['result_perc'], $valArr['result_cat']), 100), 2);
                        echo "<td nowrap>" . say_numbercolor($valArr['result_c'], $decpNum);
                        if (0 < $protmodTotal)
                        {
                            echo "<td nowrap>" . say_numbercolor($valArr['result_famt'], 0);
                            echo "<td nowrap>" . say_numbercolor($valArr['result_rsbf3'], 0);
                            if ($rate0open)
                            {
                                echo "<td nowrap>" . say_numbercolor($valArr['result_fe'], 0);
                            }
                            echo "<td nowrap>" . say_numbercolor($valArr['result_fc'], $decpNum);
                            echo "<td nowrap>" . say_numbercolor($valArr['result_c'] + $valArr['result_fc'], $decpNum);
                        }
                        echo "<td nowrap>" . say_numbercolor($valArr['result_d2'] + $valArr['result_fd2'], $decpNum);
                        if ($qchkbx)
                        {
                            if (0 < $sum_Rn)
                            {
                                $resultRS = $valArr['result_r_all'] / $sum_Rn * 100;
                            }
                            else
                            {
                                $resultRS = 0;
                            }
                            echo "<td nowrap><font color=green>" . sprintf("%01.0f", $valArr['result_r_all']) . "</font>";
                            if (0 < $resultRS)
                            {
                                echo "<td nowrap align=left><img src='image/bar3.gif' height='10' width='" . floor($resultRS / 2) . "'>&nbsp;<font color=green><small>" . sprintf("%.2f", $resultRS) . "%</small></font></td>";
                            }
                            else
                            {
                                echo "<td nowrap align=left><font color=green><small>" . sprintf("%.2f", $resultRS) . "%</small></font></td>";
                            }
                        }
                        break;
                    case 1 :
                        echo "<td nowrap>" . say_numbercolor($valArr['result_rs2f3'], 0);
                        if ($rate0open)
                        {
                            echo "<td nowrap>" . say_numbercolor($valArr['result_e'], 0);
                        }
                        echo "<td nowrap>" . say_numbercolor($valArr['result_b2'], $decpNum);
                        echo "<td nowrap>" . round(zero(zero($valArr['result_perc'], $valArr['result_cat']), 100), 2);
                        echo "<td nowrap>" . say_numbercolor($valArr['result_c'], $decpNum);
                        echo "<td nowrap>" . say_numbercolor($valArr['result_d2'], $decpNum);
                        break;
                }
                echo "</tr>";
                $sum_result_cat += $valArr['result_cat'];
                $sum_result_amt += $valArr['result_amt'];
                $sum_result_b1 += $valArr['result_b1'];
                $sum_result_c5 += $valArr['result_c5'];
                $sum_result_r5 += $valArr['result_r5'];
                $sum_result_famt += $valArr['result_famt'];
                $sum_result_fr5 += $valArr['result_fr5'];
                $sum_result_g5_fg5 += $valArr['result_g5_fg5'];
                $sum_result_r_all += $valArr['result_r_all'];
                $sum_result_d1 += $valArr['result_d1'];
                $sum_result_d2 += $valArr['result_d2'];
                $sum_result_fd1 += $valArr['result_fd1'];
                $sum_result_fd2 += $valArr['result_fd2'];
                $sum_result_rs2f3 += $valArr['result_rs2f3'];
                $sum_result_e += $valArr['result_e'];
                $sum_result_b2 += $valArr['result_b2'];
                $sum_result_perc += $valArr['result_perc'];
                $sum_result_c += $valArr['result_c'];
                $sum_result_rsbf3 += $valArr['result_rsbf3'];
                $sum_result_fe += $valArr['result_fe'];
                $sum_result_fc += $valArr['result_fc'];
            }
            echo "<tr class=gtdtotal align=right style='font-weight:bold'>";
            echo "<td align=right>总计{$sum_account}人";
            echo "<td nowrap>{$sum_result_cat}<td nowrap>{$sum_result_amt}<td nowrap>" . say_numbercolor($sum_result_b1, $decpNum);
            switch ($srcNowShowAcl)
            {
                case 5 :
                    echo "<td nowrap>" . say_numbercolor($sum_result_c5, $decpNum);
                    echo "<td nowrap>" . say_numbercolor($sum_result_r5, $decpNum);
                    echo "<td nowrap>" . say_numbercolor($sum_result_famt, 0);
                    echo "<td nowrap>" . say_numbercolor($sum_result_fr5, $decpNum);
                    echo "<td nowrap>" . say_numbercolor($sum_result_g5_fg5, $decpNum);
                    if ($flagPaperShowPn)
                    {
                        echo "<td nowrap>" . say_numbercolor($sum_result_r5 + $sum_result_fr5 + $sum_result_g5_fg5, $decpNum);
                    }
                    else
                    {
                        echo "<td nowrap>" . say_numbercolor($sum_result_r5 + $sum_result_fr5 - $sum_result_g5_fg5, $decpNum);
                    }
                    if ($qchkbx)
                    {
                        echo "<td nowrap><font color=green>" . sprintf("%01.0f", $sum_result_r_all) . "</font>";
                        if (0 < $sum_Rn)
                        {
                            $result_RS = $sum_result_r_all / $sum_Rn * 100;
                        }
                        else
                        {
                            $resultRS = 0;
                        }
                        if (0 < $result_RS)
                        {
                            echo "<td nowrap align=left><img src='image/bar3.gif' height='10' width='" . floor($result_RS / 2) . "'>&nbsp;<font color=green><small>" . sprintf("%.2f", $result_RS) . "%</small></font></td>";
                        }
                        else
                        {
                            echo "<td nowrap align=left><small>" . sprintf("%.2f", $result_RS) . "%</small></td>";
                        }
                    }
                    break;
                case 4 :
                case 3 :
                case 2 :
                    echo "<td nowrap>" . say_numbercolor($sum_result_d1 + $sum_result_fd1, $decpNum);
                    echo "<td nowrap>" . say_numbercolor($sum_result_rs2f3, 0);
                    if ($rate0open)
                    {
                        echo "<td nowrap>" . say_numbercolor($sum_result_e, 0);
                    }
                    echo "<td nowrap>" . say_numbercolor($sum_result_b2, $decpNum);
                    echo "<td nowrap>" . round(zero(zero($sum_result_perc, $sum_result_cat), 100), 2);
                    echo "<td nowrap>" . say_numbercolor($sum_result_c, $decpNum);
                    if (0 < $protmodTotal)
                    {
                        echo "<td nowrap>" . say_numbercolor($sum_result_famt, 0);
                        echo "<td nowrap>" . say_numbercolor($sum_result_rsbf3, 0);
                        if ($rate0open)
                        {
                            echo "<td nowrap>" . say_numbercolor($sum_result_fe, 0);
                        }
                        echo "<td nowrap>" . say_numbercolor($sum_result_fc, $decpNum);
                        echo "<td nowrap>" . say_numbercolor($sum_result_c + $sum_result_fc, $decpNum);
                    }
                    echo "<td nowrap>" . say_numbercolor($sum_result_d2 + $sum_result_fd2, $decpNum);
                    if ($qchkbx)
                    {
                        if (0 < $sum_Rn)
                        {
                            $resultRS = $sum_result_r_all / $sum_Rn * 100;
                        }
                        else
                        {
                            $resultRS = 0;
                        }
                        echo "<td nowrap><font color=green>" . sprintf("%01.0f", $sum_result_r_all) . "</font>";
                        if (0 < $resultRS)
                        {
                            echo "<td nowrap align=left><img src='image/bar3.gif' height='10' width='" . floor($resultRS / 2) . "'>&nbsp;<font color=green><small>" . sprintf("%.2f", $resultRS) . "%</small></font></td>";
                        }
                        else
                        {
                            echo "<td nowrap align=left><font color=green><small>" . sprintf("%.2f", $resultRS) . "%</small></font></td>";
                        }
                    }
                    break;
                case 1 :
                    echo "<td nowrap>" . say_numbercolor($sum_result_rs2f3, 0);
                    if ($rate0open)
                    {
                        echo "<td nowrap>" . say_numbercolor($sum_result_e, 0);
                    }
                    echo "<td nowrap>" . say_numbercolor($sum_result_b2, $decpNum);
                    echo "<td nowrap>" . round(zero(zero($sum_result_perc, $sum_result_cat), 100), 2);
                    echo "<td nowrap>" . say_numbercolor($sum_result_c, $decpNum);
                    echo "<td nowrap>" . say_numbercolor($sum_result_d2, $decpNum);
                    break;
            }
            echo "</td></tr>";
            if (isset($totalListFlyArr['amount']))
            {
                if ($flagAcl255)
                {
                    if ($flagPaperShowPn)
                    {
                        $sum_resultA = $sum_result_r5 + $sum_result_fr5 + $sum_result_g5_fg5;
                    }
                    else
                    {
                        $sum_resultA = $sum_result_r5 + $sum_result_fr5 - $sum_result_g5_fg5;
                    }
                    echo "<tr class=paperAll align=center><td nowrap colspan=6 rowspan=2 align=right>整合报表 总计 公司走飞及总结果";
                    echo "<td nowrap>走飞金额<td nowrap>走飞结果<td nowrap>-<td nowrap>公司总计";
                    echo "<tr align=right class=td2 valign=top>";
                    echo "<td nowrap>" . say_numbercolor($totalListFlyArr['amount'], 0) . "</td>";
                    echo "<td nowrap>" . say_numbercolor($totalListFlyArr['result1'], $decpNum) . "</td>";
                    echo "<td nowrap>&nbsp;</td>";
                    if ($paper_show_pn)
                    {
                        echo "<td nowrap><b>" . say_numbercolor($sum_resultA - $totalListFlyArr['result1'], $decpNum) . "</b></td>";
                    }
                    else
                    {
                        echo "<td nowrap><b>" . say_numbercolor($sum_resultA + $totalListFlyArr['result1'], $decpNum) . "</b></td>";
                    }
                    echo "</td></tr>";
                }
                else
                {
                    if ($rate0open)
                    {
                        $colTemp = 10;
                    }
                    else
                    {
                        $colTemp = 9;
                    }
                    echo "<tr class=paperAll align=center><td colspan=" . ( 1 < $srcNowShowAcl ? $colTemp : "4" ) . " rowspan=2 align=right>整合报表 {$title} 走飞清单总计</td>";
                    echo "<td nowrap>走飞金额</td><td nowrap>走飞退水</td><td nowrap " . ( $rate0open ? "colspan=2" : "" ) . ">走飞结果</td><td nowrap>{$title}结果 (总计)</td><td nowrap>{$srcNowShowAclTitleUP}结果 (总计)</td></tr>";
                    echo "<tr class=td2 align=right>";
                    echo "<td align=right nowrap><b>" . $totalListFlyArr['amount'] . "</b></td>";
                    echo "<td align=right nowrap><b>" . say_numbercolor($totalListFlyArr['resultB'], 0) . "</b></td>";
                    echo "<td align=right nowrap " . ( $rate0open ? "colspan=2" : "" ) . "><b>" . say_numbercolor($totalListFlyArr['result1'], $decpNum) . "</b></td>";
                    echo "<td><b>" . say_numbercolor($sum_result_c + $sum_result_fc - $totalListFlyArr['result1'], $decpNum) . "</b></td>";
                    echo "<td><b>" . say_numbercolor($sum_result_d2 + $sum_result_fd2 + $totalListFlyArr['result1'], $decpNum) . "</b></td>";
                    echo "</tr>";
                }
            }
            echo "</table>";
        }
        else
        {
            $t_cat = 0;
            $t_amt = 0;
            $t_b1 = 0;
            $t_cQ = 0;
            $t_r5 = 0;
            $t_g5 = 0;
            $t_ap = 0;
            $t_c = 0;
            $t_r = 0;
            $t_famt = 0;
            $t_fr5 = 0;
            $t_fg5 = 0;
            $t_fr = 0;
            $t_fc = 0;
            $t_f2amt = 0;
            $t_f2a = 0;
            $t_f2b = 0;
            $t_f2r5 = 0;
            $showArr = array_intersect($sorti, $totalListSortArr);
            foreach ($totalListSortArr as $theValTemp)
            {
                $theVal = $totalListArr[$theValTemp];
                $kname = $theVal['kname'];
                $subidID = $theVal['subid'];
                $bettypeID = $theVal['bettype'];
                $betlistPage = $theVal['betlistPage'];
                $listShow1G = $theVal['listShow1G'];
                $cat = $theVal['cat'];
                $amt = $theVal['amt'];
                $b1 = $theVal['b1'];
                $cQ = $theVal['cQ'];
                $r5 = $theVal['r5'];
                $g5 = $theVal['g5'];
                $ap = $theVal['ap'];
                $c = $theVal['c'];
                $r = $theVal['r'];
                $famt = $theVal['famt'];
                $fr5 = $theVal['fr5'];
                $fg5 = $theVal['fg5'];
                $fr = $theVal['fr'];
                $fc = $theVal['fc'];
                $f2amt = $theVal['f2amt'];
                $f2a = $theVal['f2a'];
                $f2b = $theVal['f2b'];
                $f2r5 = $theVal['f2r5'];
                echo "<tr align=right class=td2>";
                echo "<td width='11%' align=left nowrap>{$kname}</td>";
                echo "<td nowrap>{$cat}</td>";
                $tempUrl = "";
                foreach ($showPaperArr as $key => $val)
                {
                    $tempUrl .= "&playCheck%5B%5D=" . $key;
                }
                if ($betlistPage == "betlist")
                {
                    $agentURL = $agentURL6H;
                }
                else if ($betlistPage == "betlistAll_3d")
                {
                    $agentURL = $agentURL6H;
                }
                else
                {
                    $agentURL = "";
                }
                echo "<td nowrap><a href=\"op.php?op=agent&fp={$betlistPage}&dt1={$dt1}&dt2={$dt2}&dates={$dt1}&datee={$dt2}&bettype={$k}&gametype={$showPaperVal_showtype}&num=all&backpage=1&lid={$lid}&betRType={$betRType}&bettype={$bettypeID}&subid={$subidID}{$tempUrl}{$agentURL}&srcNowShowAcl={$srcNowShowAcl}&listShow1G={$listShow1G}\">{$amt}</a></td>";
                if (0 < $t_s_rn)
                {
                    $ap = ( $r + $fr ) / $t_s_rn * 100;
                }
                else
                {
                    $ap = 0;
                }
                if ($flagPaperShowPn)
                {
                    $cQ = ( $r5 - $b1 ) * ( 0 - 1 );
                }
                else
                {
                    $cQ = ( $r5 * ( 0 - 1 ) - $b1 ) * ( 0 - 1 );
                }
                echo "<td nowrap>" . say_numbercolor($b1, $decpNum);
                if ($flagAcl255)
                {
                    echo "<td nowrap>" . say_numbercolor($cQ, $decpNum) . "</td>";
                    echo "<td nowrap>" . say_numbercolor($r5, $decpNum) . "</td>";
                    echo "<td nowrap>" . say_numbercolor($famt, $decpNum) . "</td>";
                    echo "<td nowrap>" . say_numbercolor($fr5, $decpNum) . "</td>";
                    echo "<td nowrap>" . say_numbercolor($g5 + $fg5, $decpNum) . "</td>";
                    if ($flagPaperShowPn)
                    {
                        $totalTemp = $r5 + $fr5 + $g5 + $fg5;
                    }
                    else
                    {
                        $totalTemp = $r5 + $fr5 - $g5 - $fg5;
                    }
                    echo "<td nowrap>" . say_numbercolor($totalTemp, $decpNum) . "</td>";
                    if ($qchkbx)
                    {
                        echo "<td nowrap><font color=green>" . sprintf("%01.0f", $r + $fr) . "</font>";
                        if (0 < $ap)
                        {
                            echo "<td nowrap align=left><img src='image/bar3.gif' height='10' width='" . floor($ap / 2) . "'>&nbsp;<font color=green><small>" . sprintf("%.2f", $ap) . "%</small></font></td>";
                        }
                        else
                        {
                            echo "<td nowrap align=left><font color=green><small>" . sprintf("%.2f", $ap) . "%</small></font></td>";
                        }
                    }
                    echo "<td nowrap>" . say_numbercolor($f2amt, $decpNum) . "</td>";
                    echo "<td nowrap>" . say_numbercolor($f2r5, $decpNum) . "</td>";
                    if ($flagPaperShowPn)
                    {
                        echo "<td nowrap>" . say_numbercolor($totalTemp - $f2r5, $decpNum) . "</td>";
                    }
                    else
                    {
                        echo "<td nowrap>" . say_numbercolor($totalTemp + $f2r5, $decpNum) . "</td>";
                    }
                }
                else
                {
                    echo "<td nowrap>" . say_numbercolor($c, $decpNum) . "</td>";
                    if (1 < $srcNowShowAcl)
                    {
                        echo "<td nowrap>" . say_numbercolor($famt, $decpNum) . "</td>";
                        echo "<td nowrap>" . say_numbercolor($fc, $decpNum) . "</td>";
                        echo "<td nowrap>" . say_numbercolor($c + $fc, $decpNum);
                    }
                    echo "<td nowrap>" . say_numbercolor($f2amt, $decpNum) . "</td>";
                    echo "<td nowrap>" . say_numbercolor($f2b, $decpNum) . "</td>";
                    echo "<td nowrap>" . say_numbercolor($c + $fc - $f2b, $decpNum) . "</td>";
                    if ($qchkbx)
                    {
                        echo "<td nowrap><font color=green>" . sprintf("%01.0f", $r + $fr) . "</font>";
                        if (0 < $ap)
                        {
                            echo "<td nowrap align=left><img src='image/bar3.gif' height='10' width='" . floor($ap / 2) . "'>&nbsp;<font color=green><small>" . sprintf("%.2f", $ap) . "%</small></font></td>";
                        }
                        else
                        {
                            echo "<td nowrap align=left><font color=green><small>" . sprintf("%.2f", $ap) . "%</small></font></td>";
                        }
                    }
                }
                $t_cat += $cat;
                $t_amt += $amt;
                $t_b1 += $b1;
                $t_cQ += $cQ;
                $t_r5 += $r5;
                $t_g5 += $g5;
                $t_ap += $ap;
                $t_c += $c;
                $t_r += $r;
                $t_famt += $famt;
                $t_fr5 += $fr5;
                $t_fg5 += $fg5;
                $t_fr += $fr;
                $t_fc += $fc;
                $t_f2amt += $f2amt;
                $t_f2a += $f2a;
                $t_f2b += $f2b;
                $t_f2r5 += $f2r5;
            }
            echo "<tr class=td3 align=right style='font-weight:bold'>";
            echo "<td colspan=1 align=right>总计</td>";
            echo "<td nowrap>{$t_cat}</td>";
            echo "<td nowrap>{$t_amt}</td>";
            echo "<td nowrap>" . say_numbercolor($t_b1, $decpNum) . "</td>";
            if ($flagAcl255)
            {
                echo "<td nowrap>" . say_numbercolor($t_cQ, $decpNum) . "</td>";
                echo "<td nowrap>" . say_numbercolor($t_r5, $decpNum) . "</td>";
                echo "<td nowrap>" . say_numbercolor($t_famt, $decpNum) . "</td>";
                echo "<td nowrap>" . say_numbercolor($t_fr5, $decpNum) . "</td>";
                echo "<td nowrap>" . say_numbercolor($t_fg5 + $t_g5, $decpNum) . "</td>";
                if ($flagPaperShowPn)
                {
                    $totalTemp = $t_r5 + $t_fr5 + $t_g5 + $t_fg5;
                }
                else
                {
                    $totalTemp = $t_r5 + $t_fr5 - $t_g5 - $t_fg5;
                }
                echo "<td nowrap>" . say_numbercolor($totalTemp, $decpNum) . "</td>";
                if ($qchkbx)
                {
                    if (0 < $t_s_rn)
                    {
                        $t_ap = ( $t_r + $t_fr ) / $t_s_rn * 100;
                    }
                    else
                    {
                        $t_ap = 0;
                    }
                    echo "<td nowrap><b><font color=green>" . sprintf("%.0f", $t_s_rn) . "</font></b><td nowrap align=left>" . "<img src='image/bar3.gif' height='10' width='" . floor($t_ap / 2) . "'>&nbsp;<b><font color=green><small>" . sprintf("%.2f", $t_ap) . "%</small></font></b>";
                }
                echo "<td nowrap>" . say_numbercolor($t_f2amt, $decpNum) . "</td>";
                echo "<td nowrap>" . say_numbercolor($t_f2r5, $decpNum) . "</td>";
                if ($flagPaperShowPn)
                {
                    echo "<td nowrap>" . say_numbercolor($totalTemp - $t_f2r5, $decpNum) . "</td>";
                }
                else
                {
                    echo "<td nowrap>" . say_numbercolor($totalTemp + $t_f2r5, $decpNum) . "</td>";
                }
            }
            else
            {
                echo "<td nowrap>" . say_numbercolor($t_c, $decpNum) . "</td>";
                if (1 < $srcNowShowAcl)
                {
                    echo "<td nowrap>" . say_numbercolor($t_famt, $decpNum) . "</td>";
                    echo "<td nowrap>" . say_numbercolor($t_fc, $decpNum) . "</td>";
                    echo "<td nowrap>" . say_numbercolor($t_c + $t_fc, $decpNum) . "</td>";
                }
                echo "<td nowrap>" . say_numbercolor($t_f2amt, $decpNum) . "</td>";
                echo "<td nowrap>" . say_numbercolor($t_f2b, $decpNum) . "</td>";
                echo "<td nowrap>" . say_numbercolor($t_c + $t_fc - $t_f2b, $decpNum) . "</td>";
                if ($qchkbx)
                {
                    if (0 < $t_s_rn)
                    {
                        $t_ap = ( $t_r + $t_fr ) / $t_s_rn * 100;
                    }
                    else
                    {
                        $t_ap = 0;
                    }
                    echo "<td nowrap><b><font color=green>" . sprintf("%.0f", $t_s_rn) . "</font></b><td nowrap align=left>" . "<img src='image/bar3.gif' height='10' width='" . floor($t_ap / 2) . "'>&nbsp;<b><font color=green><small>" . sprintf("%.2f", $t_ap) . "%</small></font></b>";
                }
            }
            echo "</table>";
        }
    }
    echo "<script language=\"JavaScript\"> \r\n  $(function(){\$(\"tr[class=td2]\").hover(function() {\$(this).addClass(\"trover\");}, function() {\$(this).removeClass(\"trover\");});});\r\n  </script>";
    $ui->footer();
}
else
{
    echo "<style>\r\n.myc2{background-color:#CCF0FE; text-align:right;} .iptTimeH{text-align:right;}\r\n.iptTimeM{text-align:left;}\r\n.iptTimeBlue{ border-top-width:0px; border-left-width:0px; border-bottom-width:1px; border-bottom-style:solid; border-bottom-color:blue; border-right-width:0px; width:18px; }\r\n.iptTimeRed{ border-top-width:0px; border-left-width:0px; border-bottom-width:1px; border-bottom-color:red; border-right-width:0px; width:18px;\r\n}</style>";
    $ui->load("calendar_js", "calendar_js.htm");
    $ui->show("calendar_js");
    echo "<form name=\"f\" method=\"get\" action=\"op.php\">";
    echo "<input type=\"hidden\" name=\"op\" value=\"agent\">";
    echo "<input type=\"hidden\" name=\"fp\" value=\"paper_all\">";
    echo "<input type=\"hidden\" name=\"gametype\" value=\"" . $gametype . "\">";
    echo "<input type=\"hidden\" name=\"mypaperSrc\" value=\"1\">";
    echo "<input type=\"hidden\" name=\"nowShowAcl\" value=\"" . $nowShowAcl . "\">";
    echo "<table border=\"0\" cellpadding=\"2\" cellspacing=\"1\" class=\"table0\" width=\"950\">";
    echo "<tr><th colspan=2 style=\"background-image:url(image/bgGray.png); height:26px; font-size:14px;font-weight:bold;\">" . $title . "报表管理 (搜寻)</th></tr>";
    if ($g_init_mode_3d)
    {
        echo "<tr class=td2><td class=myc2>玩法</td><td>";
        echo "<select name=\"gameshow\" id=\"gameshow\">";
        echo "<option value=\"-1\">全部详情</option>";
        $playCheckStr = "";
        $my_gametype_3d = array ();
        $dChkStr = 0;
        $sChkStr = 0;
        foreach ($showMyPaperArr as $key => $val)
        {
            $chTemp = $val['chs'];
            $enTemp = $val['en'];
            if (2 < $key)
            {
                ++$sChkStr;
            }
            else
            {
                ++$dChkStr;
            }
            if ($gametype == $key)
            {
                $chkTemp = $gameshow == 0 - 1 ? "" : " selected ";
                $chkTemp2 = "";
            }
            else
            {
                $chkTemp = "";
                $chkTemp2 = "";
            }
            echo "<option value=\"" . $key . "\" class=\"paper" . $enTemp . "\" " . $chkTemp . " >" . $chTemp;
            $playCheckStr .= "<label class=\"paper" . $enTemp . "\" style=\"padding:2px;\"><input type=\"checkbox\" value=\"" . $key . "\" name=\"playCheck[]\" id=\"playCheck" . $key . "\" " . $chkTemp2 . " />" . $chTemp . "</label>";
            $my_gametype_3d[$key] = $val;
        }
        echo "</select>";
        $playCheckStr .= $dChkStr && $sChkStr ? "<br><label class=\"td2\"><input type=\"radio\" value=\"1\" name=\"playCheckAll\" />全选</label>" : "";
        $playCheckStr .= $dChkStr ? "<label class=\"td2\"><input type=\"radio\" value=\"2\" name=\"playCheckAll\" />六合</label>" : "";
        $playCheckStr .= $sChkStr ? "<label class=\"td2\"><input type=\"radio\" value=\"3\" name=\"playCheckAll\" />快开彩</label>" : "";
        if ($gameshow == 0 - 1)
        {
            echo "&nbsp;<span id=\"spanChkGameShow\">" . $playCheckStr . "</span>";
        }
        else
        {
            echo "<input type=\"hidden\" value=\"1\" name=\"disTotalFlag\" />";
        }
    }
    else
    {
        echo "<input type=\"hidden\" value=\"1\" name=\"disTotalFlag\" />";
    }
    echo "<tr class=\"td2\"><td class=\"myc2\">" . $srcNowShowAclTitle . "</td>";
    echo "<td><select name=\"agent\"><option value=\"\">--请选择--</option>";
    if ($pgMyAcl != 255)
    {
        $sqlAddTemp = " AND prev_id = {$pgMyId}";
    }
    else
    {
        $sqlAddTemp = "";
    }
    $rs = getdb("select id, account from k_user where acl={$srcNowShowAcl} {$sqlAddTemp} order by account");
    while (!$rs->eof)
    {
        echo "<option value=\"" . $rs->f[0] . "\">" . $rs->f[1] . "</option>";
        $rs->movenext();
    }
    echo "</select>";
    echo "<tr class=td2><td class=\"myc2\">报表种类</td><td>";
    if (!$showSpe255)
    {
        echo "<select name=papers id=papers ><option value=1>总帐</option><option value=2>分类帐</option></select>&#12288;&#12288;&#12288;&#12288;";
    }
    echo "选项&nbsp;&nbsp;<select name=\"betRType\" id=\"betRType\"><option value=\"0\" >全部</option><option value=\"1\" class=\"colorBg5h02\">上缴</option><option value=\"2\" class=\"colorBg5h01\">赢分</option></select>";
    if (2 < $pgMyAcl)
    {
        echo "&#12288;&#12288;&#12288;&#12288;<label><input type=checkbox name=qchkbx value=1>统计贡献额<font color=red>（速度较慢）</font></label>";
    }
    if (0 - 1 < $gameshow)
    {
        echo "<tr class=td0><td class=\"myc2\">下注类别";
        echo "<td class=td2><select name=\"bettype\"><option value=\"\">全部";
        foreach ($betnameShowArr as $key => $value)
        {
            echo "<option value=\"" . $key . "\">" . $value . "</option>";
        }
        echo "</select>";
    }
    echo "<tr class=td0><td class=\"myc2\">浏览日期</td>";
    echo "<td class=td2 style='text-align:left'>";
    echo "<label><input type=\"radio\" value=\"0\" name=\"hstype\" id=\"hstype0\" checked onclick=\"divHstypeShow(false);\" />本日帐<font color=red>(报表日" . $today . ")</font></label>&nbsp;&nbsp;";
    echo "<label><input type=\"radio\" value=\"1\" name=\"hstype\" id=\"hstype1\" onclick=\"divHstypeShow(true);\" />历史帐<font color=red>(已颁奖)</font></label>&nbsp;&nbsp;";
    if (!$g_init_mode_3d)
    {
        echo "<div style=\"display:none\">";
    }
    echo "<div id=\"divTdtype\" style=\"display:none\">";
    echo "<label><input type=\"checkbox\" name=\"showByTime\" id=\"showByTime\" value=\"1\"> 指定 (开奖) 时间区间 </label>";
    echo "<span id=\"showByTimeInput\">报表日";
    echo "<input size=\"10\" name=\"dtTimeArea\" value=\"" . $today . "\" id=\"dtTimeArea\" disabled /> ";
    echo "<a href=\"#\" onclick=\"javascript:showCalendarById('dtTimeArea')\"><img align=absmiddle src=\"class/calendar/calendar.png\"  alt=\"开启小月历\"  border=0></a>";
    echo "&nbsp;&nbsp;<input type=\"text\" size=\"2\" value=\"09\" name=\"sHours\" maxlength=\"2\" class=\"iptTimeBlue iptTimeH\" disabled />:<input type=\"text\" size=\"2\" name=\"sMin\" value=\"00\"  maxlength=\"2\" class=\"iptTimeBlue iptTimeM\" disabled />";
    echo "(含) ～";
    echo "<input type=\"text\" size=\"2\" value=\"18\" name=\"eHours\" maxlength=\"2\" class=\"iptTimeRed iptTimeH\" disabled />:<input type=\"text\" size=\"2\" name=\"eMin\" value=\"00\"  maxlength=\"2\" class=\"iptTimeRed iptTimeM\" disabled />";
    echo "(含)";
    echo "</span>";
    echo "</div>";
    if (!$g_init_mode_3d)
    {
        echo "</div>";
    }
    echo "<div id=\"divHstype\" style=\"display:none\">";
    $dt = date("Y-m-d");
    echo "<input size=\"10\" name=\"dt1\" value=\"" . $today . "\" id=\"dt1\" /> ";
    echo "<a href=\"#\" onclick=\"javascript:showCalendarById('dt1')\"><img align=absmiddle src=\"class/calendar/calendar.png\"  alt=\"开启小月历\"  border=0></a>";
    echo " ～ ";
    echo "<input size=10 name=dt2 value='{$today}' id=\"dt2\" /> ";
    echo "<a href=\"#\" onclick=\"javascript:showCalendarById('dt2')\"><img align=absmiddle src=\"class/calendar/calendar.png\"  alt=\"开启小月历\"  border=0></a>";
    echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
    echo "<input type=\"button\" value=\"昨日(-)\" onclick=\"javascript:getMyPaperDate(0);\" class=\"c2\" />&nbsp;";
    echo "<input type=\"button\" value=\"上周\" onclick=\"javascript:getMyPaperDate(2);\" class=\"c2\" />&nbsp;";
    echo "<input type=\"button\" value=\"本周\" onclick=\"javascript:getMyPaperDate(3);\" class=\"c2\" />&nbsp;";
    echo "<input type=\"button\" value=\"上月\" onclick=\"javascript:getMyPaperDate(5);\" class=\"c2\" />&nbsp;";
    echo "<input type=\"button\" value=\"本月\" onclick=\"javascript:getMyPaperDate(4);\" class=\"c2\" />&nbsp;";
    echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
    echo "<SELECT onchange=\"document.all.dt1.value=this.value;document.all.dt2.value=this.value;\">";
    switch ($show3D3S)
    {
        case 0 :
            echo "<OPTION value='{$dt}' selected>请选取报表日期</OPTION>";
            $rs = getdb("select * from lotto{$tbl} where open between '{$page_max_day}' AND '{$yesDay}' order by open desc");
            $i = 0;
            while (!$rs->eof && $i++ < 6)
            {
                echo "<OPTION value='" . $rs->f['open'] . "'>第 " . d3($rs->f['round']) . " 期 " . $rs->f['open'] . "</OPTION>";
                $rs->movenext();
            }
            break;
        case 1 :
        case 2 :
            echo "<OPTION value='{$dt}' selected>请选取报表日期</OPTION>";
            $rs = getdb("select open, MIN(round),MAX(round) from lotto{$tbl} group by `open` desc having `open` < '{$dt}'  limit {$page_max_count}");
            $i = 0;
            while (!$rs->eof && $i++ < 6)
            {
                echo "<OPTION value='{$rs->f[0]}'>第 {$rs->f[1]}~{$rs->f[2]} 期 {$rs->f[0]}</OPTION>";
                $rs->movenext();
            }
            break;
    }
    echo "</select>";
    echo "</div>";
    $calToday = $today;
    $calYes = $yesDay;
    $dateTempM = date("m", $todayInt);
    $dateTempD = date("d", $todayInt);
    $dateTempW = date("w", $todayInt);
    $dateTempY = date("Y", $todayInt);
    if ($dateTempW == 0)
    {
        $secTheWeek1 = mktime(0, 0, 0, $dateTempM, $dateTempD - 6, $dateTempY);
    }
    else
    {
        $secTheWeek1 = mktime(0, 0, 0, $dateTempM, $dateTempD - $dateTempW + 1, $dateTempY);
    }
    $calPreWeek1 = date("Y-m-d", $secTheWeek1 - 604800);
    $calPreWeek2 = date("Y-m-d", $secTheWeek1 - 1);
    $calTheWeek1 = date("Y-m-d", $secTheWeek1);
    $calTheWeek2 = $today;
    $calTheMon1 = date("Y-m-d", mktime(0, 0, 0, $dateTempM, 1, $dateTempY));
    $calTheMon2 = $today;
    $calPreMon1 = date("Y-m-d", mktime(0, 0, 0, $dateTempM - 1, 1, $dateTempY));
    $calPreMon2 = date("Y-m-d", mktime(23, 59, 59, $dateTempM, 1 - 1, $dateTempY));
    echo "\r\n  <script src='js_3d/js3d.js'></script>\r\n  <script language=\"JavaScript\">\r\n  function divHstypeShow(flagShow){\r\n    if(flagShow){\r\n      document.getElementById('divTdtype').style.display='none';\r\n      document.getElementById('divHstype').style.display='';\r\n      document.getElementById('dt1').value='{$yesDay}'; \r\n      document.getElementById('dt2').value='{$yesDay}';\r\n    }else{\r\n      document.getElementById('divHstype').style.display='none';\r\n      document.getElementById('divTdtype').style.display='';\r\n      document.getElementById('dt1').value='{$today}'; \r\n      document.getElementById('dt2').value='{$today}';\r\n    }\r\n    $('input#showByTime').removeAttr('checked');\r\n    $().changeDis(false);\r\n    \r\n  }\r\n  function getMyPaperDate(oId){\r\n    var calDt1 = document.getElementById('dt1');\r\n    var calDt2 = document.getElementById('dt2');\r\n    switch(oId){\r\n    case 0: calDt1.value='{$calYes}'; calDt2.value='{$calYes}'; break;\r\n    case 1: calDt1.value='{$calToday}'; calDt2.value='{$calToday}'; break;\r\n    case 2: calDt1.value='{$calPreWeek1}'; calDt2.value='{$calPreWeek2}'; break;\r\n    case 3: calDt1.value='{$calTheWeek1}'; calDt2.value='{$calTheWeek2}'; break;\r\n    case 4: calDt1.value='{$calTheMon1}'; calDt2.value='{$calTheMon2}'; break;\r\n    case 5: calDt1.value='{$calPreMon1}'; calDt2.value='{$calPreMon2}'; break;\r\n    }\r\n    return false; \r\n  }\r\n  $('input#showByTime').click(function(){\r\n    $().changeDis($(this).attr('checked'));\r\n  });\r\n  $.fn.changeDis = function(chgFlag){\r\n    if(chgFlag == 1){\r\n     $('span#showByTimeInput input').removeAttr('disabled');\r\n     for(i = 0; i < 10; i++){\r\n      $('input:checkbox#playCheck' + i).removeAttr('checked');\r\n      $('input:checkbox#playCheck' + i).attr('disabled', 'true');\r\n     }\r\n     for(i = 10; i < 40; i++){\r\n      $('input:checkbox#playCheck' + i).attr('checked', true);\r\n     }\r\n    }else{\r\n     $('span#showByTimeInput input').attr('disabled', 'true');\r\n     for(i = 0; i < 10; i++){\r\n      $('input:checkbox#playCheck' + i).removeAttr('disabled');\r\n     }\r\n     \r\n    }\r\n  };\r\n  \r\n  $('select#gameshow').change(function(){\r\n    var show = $(this).val();\r\n    var gametype = (show > -1)? show : {$gametype};\r\n    parent.mainFrame.location.reload('op.php?op=agent&fp=paper_all&gametype=' + gametype + '&gameshow=' + show);\r\n  });\r\n  \r\n  $('input:radio[name=playCheckAll]').click(function(){\r\n    $('input:checkbox[name^=playCheck]').attr('checked', false);\r\n    var sVal = $(this).val();\r\n    var sChkArr = new Array();\r\n    var sChkVal = '';\r\n    switch(sVal){\r\n      case '1' :\r\n        $('input:checkbox[name^=playCheck]').attr('checked', true).each(function(idx,ele){\r\n          sChkArr.push($(ele).val());\r\n          return true;\r\n        });\r\n        break;\r\n      case '2' : \r\n        for(i = 1; i < 10; i++){\r\n          $('input:checkbox#playCheck' + i).attr('checked', true);\r\n          sChkArr.push(i);\r\n        }\r\n        break;\r\n      case '3' : \r\n        for(i = 10; i < 40; i++){\r\n          $('input:checkbox#playCheck' + i).attr('checked', true);\r\n          sChkArr.push(i);\r\n        }\r\n        break;\r\n    }\r\n    $().setCookie('showPaper3DCK',sChkArr.join(','));\r\n  });\r\n  $(function(){\r\n    var showPaper3DCK = $().getCookie('showPaper3DCK','{$gametype}');\r\n    var showPaper3DCKArr = showPaper3DCK.split(',');\r\n    for(x in showPaper3DCKArr){\r\n      $('input:checkbox#playCheck' + showPaper3DCKArr[x]).attr('checked', true);\r\n    }\r\n    $('input:checkbox[name^=playCheck]').click(function(){\r\n      var chkArrTemp = new Array();\r\n      $('input:checkbox[name^=playCheck]:checked').each(function(idx, ele){\r\n        chkArrTemp.push($(ele).val());\r\n        return true;\r\n      });\r\n      $().setCookie('showPaper3DCK',chkArrTemp.join(','));\r\n    });\r\n    \r\n    var showBetRType3DCK = $().getCookie('showBetRType3DCK','0');\r\n    $('select#betRType').val(showBetRType3DCK);\r\n    $('select#betRType').change(function(){\r\n      $().setCookie('showBetRType3DCK',$(this).val());\r\n    });\r\n  \r\n    var showHstype3DCK = $().getCookie('showHstype3DCK','0');\r\n    $('input:radio[name=hstype]').click(function(){\r\n      $().setCookie('showHstype3DCK',$(this).val());\r\n    });\r\n    $('input:radio#hstype' + showHstype3DCK).click();         \r\n  ";
    echo "\r\n  var showPapers3DCK = $().getCookie('showPaper3DCK','1');\r\n  $('select#papers').val(showPapers3DCK);\r\n  $('span.spanPaperTitle').text('(' + $('select#papers option:selected').text() + ')');\r\n  $('select#papers').change(function(){\r\n    var sleVal = $(this).val();\r\n    $().setCookie('showPaper3DCK',sleVal);\r\n    $('span.spanPaperTitle').text('(' + $('select#papers option:selected').text() + ')');\r\n  });\r\n  ";
    echo "});\r\n  </script>\r\n  ";
    echo "<tr class=td2><td colspan=2 align=center><input type=submit value=搜寻>";
    echo "</table>";
    echo "</form>";
    $showArray = array ();
    if ($gameshow == 0 - 1)
    {
        $showArray = $showMyPaperArr;
    }
    else
    {
        $showArray[$gametype] = $showMyPaperArr[$gametype];
    }
    $headerStrTemp = "";
    $bodyStrTemp = "";
    foreach ($showArray as $key => $val)
    {
        if (2 < $key)
        {
            $tempEn = $val['en'];
            $tempCh = $val['ch'];
            $headerStrTemp .= "<td class='paper{$tempEn}'>{$tempCh}<span class='spanPaperTitle'></span></td>";
            $rs = getdb("select id,round,open from lotto_{$tempEn} WHERE '" . date("Y-m-d H:i:s") . "' >= startbet AND open != '0000-00-00' ORDER BY open DESC,openbet DESC limit 20");
            $i = 0;
            $bodyStrTemp01 = "";
            $tempPaper = "0000-00-00";
            while (!$rs->eof)
            {
                if ($rs->f[2] != $tempPaper)
                {
                    $bodyStrTemp01 .= "<hr />◎ {$rs->f[2]} ◎<br />";
                }
                $bodyStrTemp01 .= "<a href='javascript:chgPaperUrl(\"{$key}\", \"{$rs->f[0]}\");'> 第  {$rs->f[1]}&nbsp;&nbsp;期<br /></a>";
                $tempPaper = $rs->f[2];
                $rs->movenext();
            }
            $bodyStrTemp .= "<td align=center valign=top>{$bodyStrTemp01}</td>";
        }
    }
    echo "<table width='950' cellpadding=10>";
    echo "<tr align=center>{$headerStrTemp}</tr>";
    echo "<tr class=td2>{$bodyStrTemp}</tr>";
    echo "</table>";
    echo "<script>";
    echo "function chgPaperUrl(gametype, lid){\r\n    var paperS = document.getElementById('papers').value;\r\n    var url = 'op.php?op=agent&fp=paper_all&gametype=' + gametype + '&papers=' + paperS + '&nowShowAcl={$pgMyAcl}&lid=' + lid;\r\n    window.location.assign(url);\r\n  }\r\n  ";
    echo "</script>";
    echo "<font color=red>※ 贡献额於颁奖前之数据为概算值，实际数额及％应以颁奖後为准。</font><br>";
    $ui->footer();
}
?>